I'm trying to duplicate a MySQL (5.5.64-MariaDB) database on the same server by following this guide: Cloning a MySQL database on the same MySql instance
The accepted answer didn't work so I reviewed the docs over at MySQL and found that the mysqldump Options used --user
and --password
instead of the -u
and -p
flags on the linked post.
When I execute this:
mysqldump --user myUser --password myPassword dev_db | mysql -umyUser -pmyPassword staging_db
It firstly asks me to enter a password:
Enter password:
So I enter myPassword
although unsure why as it's given in the arguments list.
Then it gives the following error:
mysqldump: Got error: 1049: "Unknown database 'myPassword'" when selecting the database
If I try entering the --username
and --password
without spaces:
mysqldump --usermyUser --passwordmyPassword dev_db | mysql -umyUser -pmyPassword staging_db
It errors
mysqldump: unknown option '--usermyUser'
The intention of this is to copy dev_db
into a database called staging_db
. Both of these databases exist on the same server. The username/password I'm using has full access to every database on the MySQL instance.
Why doesn't this work?
If I use:
$ mysql -umyUser -pmyPassword
It connects without any issue and gives me the MariaDB command prompt.
Server is running CentOS Linux release 7.7.1908 (Core)
Database version:
$ mysql -V
mysql Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1