Search code examples
databasemysql-workbenchrenamemysql-shell

Renaming database on Mac in Workbench


I have a task of creating a database in Workbench, MySQL. Unfortunately I used capital letters in the name of the database and later found that there is a bug in Workbench and capital letter names do not allow to dump the database. So it should be renamed into lowercase. ALTER RENAME does not do the trick. Looks like I have to do it in mysql shell. I installed it (MySQL Shell 8.2.1), but I don't think I understand how to connect to my database and dump it. when in mysql shell, I run $mysqldump -u <username - used my username here> -p"password - used my password to database" -R oldDbName > oldDbName.sql : $ mysqldump -u fhfhfkozak -p"password" -R TTF_Database2 > TTF_Database2.sql I get "Unexpected identifier 'mysqldump' " Did anyone have the same problem? Otherwise I have to make this database again, which is not delightful)

I found a solution as follows: dump the old database via mysql shell and then create a new database and restore into it the old database tables.

But as I wrote above, I am stuck at the first step: when in mysql shell, I run $mysqldump -u <username - used my username here> -p"password - used my password to database" -R oldDbName > oldDbName.sql : $ mysqldump -u fhfhfkozak -p"TheVorsklaofofo" -R TTF_Database2 > TTF_Database2.sql I get "Unexpected identifier 'mysqldump' "


Solution

  • mysqldump looks like a good idea, but you said you have a problem with exporting due to capital letters. Maybe you could dump all databases:

    mysqldump -u root -p --all-databases > alldb.sql
    

    Alternatively, you could create a new database and recreate your tables and copy all the data. Then export this new database and maybe drop the old one.