I'd like to duplicate a mysql database I've named db1 using the command line. In doing so, I'd like to grab all the tables and fields from db1, but not its values.
I've seen many SO Q&A on this topic. For example, Copy/duplicate database without using mysqldump. Unfortunately, I'm unable to accomplish two-step process suggested in this link:
- create database
- mysqldump from db1 to db2
here's my code starting at bash terminal:
ubuntu@ip-xx-xxx-xxx-xx:~$ sudo -i
root@ip-xx-xxx-xxx-xx:~# mysql -h mysite.com -u timpeterson -p
Enter password:
mysql> create database `db2`;
ERROR 1044 (42000): Access denied for user 'timpeterson'@'%' to database 'db2'
It seems worth noting that I can create db2 as long as I don't become root by typing sudo i. Unfortunately, if I don't become root I can't figure out how to access my db2 remotely which is what I ultimately need to do. That is, I don't know how to access db2 from my web app, mysite.com.