关闭正在运行的 MySQL :mysql
[root@www.woai.it ~]# service mysql stopsql
运行数据库
[root@www.woai.it ~]# mysqld_safe --skip-grant-tables &安全
为了安全能够这样禁止远程链接:ide
[root@www.woai.it ~]# mysqld_safe --skip-grant-tables --skip-networking &ui
使用mysql链接server:加密
[root@www.woai.it ~]# mysql -p.net
更改密码:rest
mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';server
*特别提醒注意的一点是,新版的mysql数据库下的user表中已经没有Password字段了
而是将加密后的用户密码存储于authentication_string字段
mysql> flush privileges;
mysql> quit;
修改完毕。重启
[root@localhost ~]# service mysql restart
而后mysql就能够链接了
但此时操做彷佛功能不彻底,还要alter user…
mysql> alter user 'root'@'localhost' identified by '123';
这样也能够:
mysql> set password for 'root'@'localhost'=password('123');