I have a MySQL database which I want to duplicate using the Ubuntu Linux CLI without first having to download a MySQL file. I tried the following command:
mysql -uroot -e'mysqldump -uroot db_old | mysql -uroot backup db_new;'
But got this error: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use.
What am I doing wrong? What I'm looking for is for db_new to be created containing the same data as db_old (in other words, copy db_old and name the new database db_new, all in one command without needing to export the data to a file).