"MySQL" common operations

Source: Internet
Author: User

2.mysql

Service MySQL Status

MySQL--version

Mysql-h Server host address-u user name-P user Password

Exit exits

MYSQL-H host name-u user name-P connection remote MySQL

1, database Backup command
Mysqldump-h localhost-u root-p--default-character-set=utf8 dbname >backup.sql

2, Import the database:
Mysql-h localhost-u root-p--default-character-set=utf8 dbname < Backup.sql

3. Delete

Yum remove MySQL mysql-server mysql-libs compat-mysql51

Rm-rf/var/lib/mysql

Rm/etc/my.cnf

See if you have MySQL software:

Rpm-qa|grep MySQL

Some words continue to delete

4. Authorization one, MySQL authorization
The syntax for the GRANT statement is as follows:
GRANT Privileges (columns)
On what
To user Identifiedby "password"
With GRANT OPTION
1.grant Select,insert On * * to [e-mail protected] "local" identified by "123";
This command means that the authorized user "test" (whose password is "123") can only be logged on locally localhost and can be
Database
Any table ("*. *" Before "*" represents any database, and the latter "*" represents any table under the constraints of the previous "*") for select,insert operations.
2.grant Update,delete on Scut.student to [e-mail protected] "%" identified by "123";
This command means that the authorized user "test" (its password is "123") can be any host login, the database "Scut" under the table "Student" for update,delete operation.
3. Grant all on len.* to [e-mail protected] "%" identified by "123456";
This command means that the authorized user "Ca" (whose password is "123456") can log on to any host and perform all operations on all tables under the database "Len".
Second, MySQL licensing view
Select User from mysql.db where db= "Youdb"
Example: Viewing a user who has been authorized by the Len database
Select User from mysql.db where db= "Len"

"MySQL" common operations

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.