MySQL重置密码,环境变量
重置密码
Access denied for user 'root'@'localhost' (using password: YES)
1.停止mysql服务。service mysqld stop
2. 运行下面命令,后保留窗口。mysqld_safe --user=mysql --skip-grant-tables --skip-networking
3.新开窗口会话,顺序执行下面命令。
mysql
update mysql.user set password=PASSWORD('password') where user='root';
flush privileges;
update mysql.user set host='%' where user='root' and host='localhost';
quit;
service mysqld restart
环境变量
在/etc/profile
中添加:export PATH=$PATH:/usr/local/mysql/bin
使配置生效source /etc/profile