MySQL Database common commands
1. Display Database
SHOW DATABASES; Display Database
SHOW DATABASES;
MySQL-User rights-related data
SYS-a table in which the database's related configuration resides
INFORMATION_SCHEMA MySQL itself schema-related data
Performance_schema is primarily used to collect database server performance parameters
2. Create a database
CREATE database name DEFAULT CHARSET UTF8 COLLATE utf8_general_ci; Create a UTF-8 encoded database
Jxiou DEFAULT CHARSET UTF8 COLLATE utf8_general_ci;
CREATE database name DEFAULT CHARACTER SET GBK COLLATE gbk_chinese_ci; Create a GBK encoded database
CREATE DATABASE jxioujjj DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
3. Using the Database
Use database name; Select a specified database
Use Jxiou
Show TABLES; display all tables in the currently used database
SHOW TABLES;
4. Delete Database
drop database name; To delete a specified database
Drop database jxioujjj;
5. User Management
Note: The default root user is the Super administrator
Create user
Create user ' username ' @ ' IP address ' identified by ' password '; Create a user
Create user ' xyhu ' @ ' 127.0.0.1 ' identified by ' 279819 ';
View all users in the MySQL database
SELECT DISTINCT CONCAT (' User: ', user, ' @ ', host, '; ') as query from Mysql.user;
SELECT DISTINCT CONCAT (' User: ', user, ' @ ', host, '; ') as query from Mysql.user;
Delete User
drop user ‘用户名‘@‘IP地址‘;
Drop user ' xyhu ' @ ' 127.0.0.1 ';
Modify User Name
rename user ‘用户名‘@‘IP地址‘ to ‘新用户名‘@‘IP地址‘;
Rename user ' Xyhu ' @ ' 127.0.0.1 ' to ' xyhuuu ' @ ' 127.0.0.1 ';
Change Password
set password for‘用户名‘@‘IP地址‘= Password(‘新密码‘);
Set password for ' root ' @ ' localhost ' = password (' 279819 ');
Section No. 276, MySQL database common commands