一.mysql 启动方法
1./etc/init.d/mysqld start
2./usr/local/mysql/bin/mysqld_safe --user=mysql &
&:代表后台启动mysql服务
二.mysql 登陆方法:
1.刚装完系统没密码情况:mysql 或者mysql -uroot
2.标准的登陆方法:mysql -uroot -p
3.多实例登陆方法:
mysql -uroot -p -S /data/3306/mysql.sock #指定下sock文件
mysql -uroot -p -S /data/3307/mysql.sock
三.mysql关闭方法
1.用专门的脚本关闭
四.mysql建用户.并授权方法
1.分2步的方法:
create user 'test'@'localhost' identified by 'test11';
grant select on mysql.* to 'test'@'localhost' ;
2.直接一条命令:
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)
五.mysql修改密码方法:
1.安装完后,设置密码方法:
a.mysqladmin -uroot password 'test88'
b.[root@ser200 3306]# mysqladmin -uroot password 'mybaby3306' -S /data/3306/mysql.sock
#多实例的例子
2.修改密码
a. [root@ser200~]# mysqladmin -uroot -p'mybaby99' password 'ainini99'
b. [root@ser200~]# mysqladmin -uroot -p'mybaby99' password 'ainini99' -S /data/3306/mysql.sock
六.找回丢失密码:
1.单实例
[root@ser200 ~]# killall mysqld
[root@ser200 ~]# 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)
你可能还对mysql编译参数查看的相关内容感兴趣