7/31/2023 0 Comments Rename db mysql![]() With the above command, we have managed to change the database name associated with a specific database table name. $ sudo mysql -u root linuxshelltips_new_db RENAME TABLE linuxshelltips_new_db.tasks TO linuxshelltips_revised_db.tasks Lastly, dump the old db ( linuxshelltips_db) files into the new database ( linuxshelltips_new_db). $ sudo mysqldump -u root linuxshelltips_db > linuxshelltips_db.sql Therefore, create a backup copy of the database whose name you wish to change. The command syntax for backing up a MySQL database using the mysqldump command is as follows: $ sudo mysqldump -u -p > Where is the root database user password and linuxshelltips_new_db is the name of the new database. $ sudo mysqladmin -u root create linuxshelltips_new_db > CREATE DATABASE linuxshelltips_new_db Īlternatively, you could create a new MySQL database using the mysqladmin command if you do not want to directly use the database shell. $ sudo mysql -u root -pįor demonstration purposes, we will go with the linuxshelltips_new_db database, which will replace the existing linuxshelltips_db database. The first step is to log in to your MySQL shell and identify the database you need to backup. Using the mysqldump shell command, an entire MySQL database dumped copy can be created as a backup copy.Īfterward, a new database with the required name is created, and then the initially created database backup copy is restored to this new database. This approach is recommended for relatively small databases. Have MySQL/MariaDB RDBMS installed and correctly configured with root database user access on the Linux system you are using.Have sudoer/root user privileges on the Linux system distribution you are using as you might require it to access the MySQL database like the case of the Ubuntu Linux distribution.Therefore, this article is here to provide some light at the end of this tunnel through other alternative means of changing the MySQL database name without posing a database security risk. The deprecation of the above MySQL query as a way of changing the database’s original name came into fruition as a means of coping with viable security risks. However, the use of the above command was a reserved privilege for older MySQL RDBMS versions. You just needed to execute the command: > RENAME DATABASE name_of_your_mysql_database ![]() ![]() Renaming/altering the name of a MySQL database was a no-brainer in the past as all it took was a simple command prefix for the database name to be successfully changed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |