mysql服务起不来

-- 当不能用service mysqld start启动,找到mysql.server的位置
find / -name mysql.server


-- 关掉mysql
/opt/mysql/support-files/mysql.server stop


-- 打开/etc/my.cnf配置文件
vim /etc/my.cnf


-- 跳过授权表启动MySQL服务程序 修改my.cnf配置,添加 skip_grant_tables=1启动设置, 然后保存退出
skip_grant_tables=1


-- 输入mysql直接进入数据库
mysql


-- 修改密码
update mysql.user set authentication_string=password('123456')   where user='root' and host='localhost';
FLUSH PRIVILEGES;          #刷新授权列表
exit;   #退出数据库


-- 重新以正常方式启动MySQL服务程序,验证新密码
vim /etc/my.cnf  #打开my.cnf配置表 删掉skip_grant_tables=1这行 并保存退出


-- 正常登陆
mysql -uroot -p123456


-- 远程登陆权限
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
FLUSH PRIVILEGES;          #刷新授权列表

-- 如遇 Your password does not satisfy the current policy requirements 报错,则修改mysql 密码策略
SHOW VARIABLES LIKE 'validate_password%';
 set global validate_password_policy=LOW; 
 set global validate_password_length=6;
FLUSH PRIVILEGES;


关联网址:
https://blog.csdn.net/tianshuhao/article/details/90822788
https://www.cnblogs.com/zgqbky/p/11720406.html
https://blog.csdn.net/hello_world_qwp/article/details/79551789

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值