My database name is studenttRecord
. I would like to correct the spelling to studentRecord
. How can I change it if possible?
Mysql – Rename the database name through terminal
MySQL
Related Question
- Mysql – How to create a thesql stored procedure through linux terminal
- Mysql – Change MySQL database name in SQL file
- Amazon RDS MySQL – How to Change Database Name?
- MySQL – How to Get Table Name from Union Query
- Mysql – Fast copy/rename database, not thesqldump
- Mysql – how can i rename all the tables in a database so the first character of each table’s name is removed
Best Answer
Firstly, create the new database with the command;
Then transfer the contents from the old database into the new database;
(add in the username and password bits as appropriate)
The
--opt
part will add a number of standard flags to the data dump, and I refer you to the MySQl documentation for more information.Once the transfer is complete, and you have verified it, you can drop your old database.
If your database is particularly huge, this can take some time to perform, so an alternative is to
RENAME TABLE
for each of the tables in the old database, and move them into the new database.Create the database as above, then for each table do the following;
Replacing
table_name
with each of your tables in turn (create a script of this in a text editor to help prepare a complete list!).Hope that helps, Dave