How to rename a table in phpMyAdmin and MySQL
October 21, 2022
How to rename a table in phpMyAdmin
Open the database and then navigate to the table you want to rename.
When the table is open, select the “Operations” menu item.
Locate the “Move table to (database.table)” section. Yes, renaming uses the same function as moving a table to another database.
Enter a new table name and click the “Go” button.
Now the table has been given a new name.
How to rename a table in MySQL
To connect to MySQL or MariaDB DBMS on localhost without a password, use the command:
mysql -u root
To connect to MySQL or MariaDB DBMS on localhost with a password, use the command:
mysql -u root -p
Note that you do not need to specify a password after the -p option – you will need to enter the password at the command prompt.
If you are connecting to a remote server, then you can also use the -h (or --host=NAME) option with the host name or IP address.
After connecting to MySQL/MariaDB you can use the following command:
RENAME TABLE `DATABASE`.`TABLE NAME` TO `DATABASE`.`NEW TABLE NAME`;
You can also choose which database to use and leave out the database name next to the table name:
USE `DATABASE`; RENAME TABLE `TABLE NAME` TO `NEW TABLE NAME`;
An example of renaming a table in MySQL:
RENAME TABLE `test`.`OLD NAME` TO `test`.`NEW NAME`;
An example of renaming a table in MySQL with database preselection:
USE `test`; RENAME TABLE `OLD NAME` TO `NEW NAME`;
To list tables, use the following SQL query:
- “Failed - Network error” when exporting from phpMyAdmin (SOLVED) (100%)
- How to change default export settings in phpMyAdmin (76.3%)
- Errors “Incorrect definition of table mysql.event: expected column 'definer' at position 3 to have type varchar(, found type char(141)” and “Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler” (SOLVED) (68.7%)
- Password and unix_socket authentication in MySQL and MariaDB. Error “#1698 - Access denied for user ‘root’@’localhost’” (SOLVED) (64.4%)
- How to install a web server (Apache, PHP, MySQL, phpMyAdmin) on Linux Mint, Ubuntu and Debian (64.4%)
- How to install PowerShell in Linux Mint (RANDOM - 50%)