I. MySQL Startup method
1./etc/init.d/mysqld start
2./usr/local/mysql/bin/mysqld_safe--user=mysql &
&: Start MySQL service on behalf of the background
two. mysql Login method:
1. The system does not have the password condition: MySQL or Mysql-uroot
2. Standard method of landing: Mysql-uroot-p
3. Multi-Instance Login method:
Mysql-uroot-p-s/data/3306/mysql.sock #指定下sock文件
Mysql-uroot-p-s/data/3307/mysql.sock
three. mysql Shutdown method
1. Close with a dedicated script
four. mysql build user. and authorization Method
1. The method of 2 steps:
Create user ' test ' @ ' localhost ' identified by ' test11 ';
Grant SELECT on mysql.* to ' test ' @ ' localhost ';
2. A direct command:
Mysql> Grant Select on mysql.* to ' test2 ' @ ' localhost ' identified by ' test22 ';
Query OK, 0 rows Affected (0.00 sec)
Mysql> select User,host from user;
+-----------+-----------+
| user | Host |
+-----------+-----------+
| Root | 127.0.0.1 |
| Root | localhost |
| Test | localhost |
| Test2 | localhost |
| WordPress | localhost |
+-----------+-----------+
5 rows in Set (0.00 sec)
five. MySQL Change Password method:
1. After installation, set the password method:
A.mysqladmin-uroot-password ' test88 '
B.mysqladmin-uroot-password ' test88 '-s/data/3306/mysql.sock #多实例的例子
2. Change the password
A. [Email protected]~]# mysqladmin-uroot-p ' mybaby99 ' password ' ainini99 '
b. [Email protected]~]# mysqladmin-uroot-p ' mybaby99 ' password ' ainini99 '-s/data/3306/mysql.sock
six. Recover lost Password:
1. Single Instance
[Email protected] ~]# Killall mysqld
[Email protected] ~]# mysqld_safe--skip-grant-table & mysql-uroot-p
mysql> use MySQL;
Database changed
mysql> Update user Set Password=password (' mygirl99 ') where user= ' root ';
Query OK, 2 rows Affected (0.00 sec)
Rows matched:2 Changed:2 warnings:0
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
You may also be interested in the contents of MySQL compilation parameter review
MySQL Startup change Password