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