Basic operation of MySQL database

Source: Internet
Author: User


--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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.