About 680,000 results
Open links in new tab
  1. How do I rename a MySQL database (change schema name)?

    Create the new database schema with the desired name. Rename the tables from old schema to new schema, using MySQL’s “RENAME TABLE” command. Drop the old database schema. If there are views, triggers, functions, stored procedures in the schema, those will need to be recreated too. MySQL’s “RENAME TABLE” fails if there are triggers ...

  2. SQL Query to Rename Database - GeeksforGeeks

    Nov 27, 2024 · To change the name of a database in SQL, use the syntax: ALTER DATABASE [current_database_name] MODIFY NAME = [new_database_name]; To rename a database in MySQL use the query:

  3. Ways to Rename a Database in MySQL 8 (3 Ways) - Sling Academy

    Jan 26, 2024 · Renaming a database can be essential during a system upgrade, rebranding, or just making database names more descriptive. In MySQL 8, there isn’t a direct RENAME DATABASE command due to the complexity and risk of file-based metadata corruption. However, there are several workarounds to achieve similar outcomes. Solution 1: Using RENAME TABLE

  4. How to rename MySQL Database? - California Learning Resource …

    Dec 11, 2024 · Method 1: Renaming a MySQL Database using SQL. The simplest way to rename a MySQL database is using SQL. Here’s how: Step 1: Stop all transactions. mysql> SHOW OPEN TABLES; Step 2: RENAME the database. RENAME TABLE myolddatabase TO mynewdatabase; Step 3: Drop the old database. DROP DATABASE myolddatabase; Method 2: Renaming a MySQL Database ...

  5. How to Rename a MySQL Database in 8 Easy Methods - Devart …

    Dec 3, 2024 · Renaming a database in MySQL involves creating a new empty database with the desired name and transferring the contents from the old database. Once the transfer is complete, the old database can be archived or dropped as needed.

  6. How to Rename a Database in SQL - Baeldung

    Oct 5, 2024 · In this tutorial, we’ll show how to rename a database in three major SQL database management systems: SQL Server, PostgreSQL, and MySQL. The examples we’ll discuss are based on the Baeldung University database. 2. In SQL Server, we can use the ALTER DATABASE statement to rename a database:

  7. Renaming a MySQL Database: Methods & Tips | Atlassian

    In short, you can use the RENAME TABLE command within a MySQL prompt to effectively change the database name of a particular table while keeping the table name intact. However, doing so requires that the database with the new name already exists, so begin by creating a new database using the mysqladmin shell command as seen above.

  8. MySQL - How to rename a database in MySQL? | TablePlus

    Jul 3, 2018 · There are a couple ways to rename a MySQL database: 1. Using SQL query. You have to create a new database first: Then rename all the tables from the current database to the new database: Then drop the old database: 2. Using shell command: do mysql -u username -ppassword -sNe "rename table old_db.$table to new_db.$table"; done. 3. Using TablePlus.

  9. How to Use the SQL ALTER DATABASE Statement to Modify

    One of the most common uses of the ALTER DATABASE statement is to change the name of a database. The MODIFY NAME clause lets you easily change the database name. For example, to rename a database from "old_db" to "new_db": To change the properties of a database file, use the MODIFY FILE option:

  10. SQL RENAME Database - Java Guides

    This chapter will guide you through the steps to rename a database using SQL. To rename a database, you will follow these steps: Create a new database with the desired name. Transfer all data from the old database to the new database. Drop the old database. First, create a new database with the new name.

  11. Some results have been removed
Refresh