0

My database name is studenttRecord. I would like to correct the spelling to studentRecord. How can I change it if possible?

  • 1
    Hi, First of all, welcome to the site. This Q and A format works best when a question contains only one single question. If you have two questions please post 2 separate questions. – Tom V - try topanswers.xyz Feb 29 '16 at 14:44
  • ok..But can you answer the other one.. Can we retrieve the complete varchar value – Naga Bhavani Mar 1 '16 at 5:47
2

Firstly, create the new database with the command;

mysql> CREATE DATABASE studentRecord;

Then transfer the contents from the old database into the new database;

shell$ mysqldump --opt studenttRecord | mysql studentRecord

(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;

mysql> RENAME TABLE studenttRecord.table_name TO studentRecord.table_name;

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

| improve this answer | |
1

In MySQL, You can't rename a schema(database), instead you can create database with the new name and recreated all the objects to it and drop the actual one.

| improve this answer | |
  • As the other answer says, you don't actually need to recreate the objects; simply RENAME. – Rick James Mar 3 '16 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.