Exporting Database to file

Windows

$databaseName="MYSQL_DATABASE_NAME"
echo "Dumping data..."
mysqld -u root start # starting daemon
net start MySQL # starting service
mysqldump -uroot -p $databaseName > databaseBackUp.sql # dumping database to file 

Linux & Mac OS

databaseName="MYSQL_DATABASE_NAME"
echo "Dumping data..."
mysqld -u root start # starting daemon
net start MySQL # starting service
mysqldump -uroot -p $databaseName > databaseBackUp.sql # dumping database to file 

Linux