MySQL Common operations

Source: Internet
Author: User

1. Add user groups and users
Groupadd MySQL
useradd-g MySQL mysql

2. Set User Permissions
chown-r Mysql:mysql/var/lib/mysql

3. Connect to the database
mysql-h host address-u user name-P user password

3. Exit
Exit

4. Set the password
mysqladmin-u username-p Old password password new password

5. Add Users
grant permissions on the database. * to User name @ login host identified by "password"
For example:
Grant Select,insert,update,delete on * * to [e-mail protected] identified by "123456";
Grant all privileges on * * to [e-mail protected] identified by "123456";

Clear Password:
Grant Select,insert,update,delete on mydb.* to [e-mail protected] identified by "";

6. Set the password in MySQL
set password for ' xql ' @ ' localhost ' = password (' 123456′ ');

7. Delete Account
Drop User Xql

8. Import from Text
load Data infile "/home/xql/tmp/xxx.txt" into table t_xxx;

9. Backup of the database
mysqldump-uroot-p12345 name > Name.sql

10. Recovery of databases
mysql-uroot-pffffff Ultrax < 2.sql
                                                        

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.