Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql (1) addition, deletion, modification and query of Mysql database

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Addition, deletion, modification and query of mysql database

Add: create database DBname charset gbk; delete: drop database DBname

Change: alter database DBname charset gbk; (change character set) rename as follows:

Check: show databases; (show databases like'% name';)

Check: view database definition: show create database library name

(renamed) Baidu has about these three methods:

1. RENAME DATABASE db_name TO new_db_name

This. This syntax was added in mysql 5.1.7 and removed in 5.1.23.

It is said that it is possible to lose data. It's better not to use it.

two。 If all tables are of MyISAM type, you can change the name of the folder

Close mysqld

Rename the db_name directory in the data directory to new_db_name

Turn on mysqld

3. Rename all tables

CREATE DATABASE new_db_name

RENAME TABLE db_name.table1 TO new_db_name.table1

Db_name.table2 TO new_db_name.table2

DROP DATABASE db_name

Scan Wechat and follow the official account.

Video of irregularly sharing information

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report