Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:15:36+00:00 2026-06-15T10:15:36+00:00

How can I rename the MySQL database name using query? I tried rename database

  • 0

How can I rename the MySQL database name using query?

I tried rename database via phpmyadmin and getting the following error,

SQL query:

    RENAME DATABASE test TO test_bkp

MySQL said: 

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATABASE test To test_bkp' at line 1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:15:37+00:00Added an answer on June 15, 2026 at 10:15 am

    It says here that:

    This statement was added in MySQL 5.1.7 but was found to be dangerous
    and was removed in MySQL 5.1.23. It was intended to enable upgrading
    pre-5.1 databases to use the encoding implemented in 5.1 for mapping
    database names to database directory names (see Section 9.2.3,
    “Mapping of Identifiers to File Names”). However, use of this
    statement could result in loss of database contents, which is why it
    was removed. Do not use RENAME DATABASE in earlier versions in which
    it is present.

    You can import all data into a new database then delete the old one.

    It is also possible to use the RENAME TABLE statement using same from/to table name but different from/to database. There are a few catches.

    CREATE DATABASE `test_bkp`;
    
    RENAME TABLE 
    `test`.`table1` TO `test_bkp`.`table1`,
    `test`.`table2` TO `test_bkp`.`table2`,
    `test`.`table3` TO `test_bkp`.`table3`;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I rename table column renaming using LINQ like in regular SQL SELECT
I am working on SQL SERVER 2008 & 2008 R2. How can I rename
how can I by using Ado.net rename existing column in a table and changing
Where can i get boost .lib for visual studio 2010?? I tried to rename
i am adding data from vba excel using adodb into a mysql database everything
Can someone explain to me why I am receiving the following error? I want
So I have a MySQL database that I'm using with a PHP site. Over
MySQL has a RENAME TABLE statemnt that will allow you to change the name
ERROR 1025 (HY000): Error on rename of '.\forumf\#sql-1718_20' to '.\forumf\posts' (errno: 150) Is the
I got this table with a column name Catégorie which I can't rename (long

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.