Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to rename database in MySQL?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 624
    Comment on it

    To rename a database in MySQL you need to follow the steps given below:

    • Dump the schema using Mysqldump
    • Restore the dump schema to other schema
    • Drop the old schema(if required)

    For Example: Suppose we have a database emp which needed to renamed as employees. For this we will write the following MySQL statements using command line:

    Step 1:Dump the emp by using following statement

    mysqldump -u root -p emp > emp.sql
    

    Step 2: Create new database employees

    mysql -u root -p -e "create database employees"
    

    Step 3:Restore the emp database to employees db

    mysql -u root -p employees < emp.sql
    

    Step 4:Drop the database emp

    mysql -u root -p -e drop database emp
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: