--Connect to MySQL database (provided the environment variable of MySQL database is configured, add path)
Mysql-uroot-p
--Set the input and output encoding of the text: CMD uses GBK, otherwise garbled
Set names GBK;
--Create a database
Create DATABASE MyDatabase charset UTF8;
--Create User user001
Create user user001 identified by ' user001 ';
--Authorized to user user001
Grant all on MyDatabase. * to user001;
--Log in to MyDatabase database using user001 account
Mysql-uuser001-p
--Enter Database MyDatabase
Use MyDatabase; --Semicolon dispensable
--View the version of the current database
SELECT @ @version;
Select version ();
--View the currently logged in user
Select User ();
--View the user, address, password (encrypted display) of the system
Select User,host,password from Mysql.user;
--View the storage engine provided by the current database
Show engines;
--View the storage engine for the current database
Show variables like '%storage_engine% ';
--View all stored procedures
Show procedure status;
Show CREATE PROCEDURE Pro_name; --View the creation information for a single stored procedure
--View functions
Show function status;
--View triggers
Show triggers;
Show Triggers\g
--See if the database turns on the Log_bin log feature
Show variables like '%log_bin% ';
--Immediately after, view the log currently written
Show master status;
--Find the database installation path,/ETC/MY.CNF find the log configuration path
Log-bin =/mysql/log-bin
--then open the database log file with the Mysqlbinlog of the database
Mysqlbinlog/var/lib/mysql/log-bin ...;
Basic operation of MySQL database