mysql -u username -ppassword databasename < filename.sql
Example
Username: daniel
Password: 123Headadmin
Database name: my_new_db
Database file name: my_old_db.sql
mysql -u daniel -p123Headadmin my_new_db < my_old_db.sql
My personal notebook
mysql -u username -ppassword databasename < filename.sql
Example
Username: daniel
Password: 123Headadmin
Database name: my_new_db
Database file name: my_old_db.sql
mysql -u daniel -p123Headadmin my_new_db < my_old_db.sql
I have a script to dump the sql database to file. Now i get the message:
Warning: Using unique option prefix u instead of user is deprecated and will be removed in a future release. Please use the full name instead.
In my script I specified the user like this: –u daniel
My solutions to the problem was to change it to: –user=daniel
I wanted to change a MySQL database name via phpMyAdmin. This is how I did it:
1. Login to phpMyAdmin.
2. Select the database you want to rename.
3. Click on operations tab.
4. In the “rename database to” section, specifiy the new name of the database.
5. You will get a question saying “CREATE DATABASE olddatabasename / DROP DATABASE newdatabasename”. Click ok.
6. Next you will be asked to reload the database. Click yes.
What happens is that you are creating a new database with a new name, dumping all tables of the old database into the new database and droping the old database. So remember that you will have to check your privileges becuase the old privileges from the old database will not be included.
If you are running a WordPress website you need to modify wp-config.php to start using the new database name.
© headadmin.net. All rights reserved.