• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Categories
  • Contact Us
    • Advertising
    • Requests
    • Privacy Statement
HelpSpa.com

HelpSpa.com

Computer Tutorials

MySQL: How to Change the Database Name

October 13, 2009 by davidwank

Once you’ve created a MySQL database and named it you cannot rename the database using standard SQL commands such as ALTER in the same manner as you would rename a table. The way to rename a database is as simple as creating a new, empty database, and then recreating the old database in this new database.

Here are the detailed steps:

1. Run a mysqldump on the existing database. Let’s assume you named the export file myDatabase.sql. For instructions how to do this see my post about running the mysqldump command.

2. Create a new database using the create database command.
[shell]CREATE DATABASE newDatabase;[/shell]

where newDatabase is the name of the new (renamed) database.

3. Use the USE command to make sure you are working with the new database.
[shell]USE newDatabase;[/shell]

4. Execute the .sql script you generated in step 1 from the old database — which is easiest to do from phpMyAdmin or from the query browser.

Don’t forget to add “;” to end your statements.

Presto! You now have a renamed database!

Filed Under: MySQL Tagged With: MySQL

Primary Sidebar

More to See

Google Analytics 4 Migration Training

December 22, 2022 By davidwank

Hubspot Zoom Webinar Integration

Connecting HubSpot and Zoom Webinars

August 27, 2022 By davidwank

Google Analytics as we know it is going away!

July 24, 2022 By davidwank

Footer

Text Widget

This is an example of a text widget which can be used to describe a particular service. You can also use other widgets in this location.

Examples of widgets that can be placed here in the footer are a calendar, latest tweets, recent comments, recent posts, search form, tag cloud or more.

Sample Link.

Recent

  • Google Analytics 4 Migration Training
  • Connecting HubSpot and Zoom Webinars
  • Google Analytics as we know it is going away!
  • Building a New Dental Website?
  • BackupBuddy Timeouts on GoDaddy Hosting

Search

Tags

Adobe Acrobat Backup classical music and opera cPanel DAM Database Digital Photography email Excel Facebook Firefox hardware HP Security HTML iMovie Internet Explorer iTunes linksys Microsoft Office Microsoft Word MySQL networking Office 2010 OneNote OpenOffice OS X PDF PHP printers reseller hosting Reviews router SEO subversion Video Virtualization Virtual PC Web Design Web Development Web Hosting Windows Windows 7 Windows Vista Windows XP Wireless

Copyright © 2023 · Magazine Pro on Genesis Framework · WordPress · Log in