0
点赞
收藏
分享

微信扫一扫

AR导航技术加持,图书馆阅读体验智慧升级

非宁静不致远 2024-07-01 阅读 7

这里写目录标题

更改登录密码:

有权限账号能登录mysql中:

set password=password('redhat');    

有权限账号不能登录mysql中:

systemctl stop mariadb  #停止mysql
vim /etc/my.cnf   #更改配置文件
[mysqld]
skip-grant-tables
systemctl start mariadb
mysql -uroot
use mysql;
select Host,User,Password from mysql.user; 
grant all on *.* to root@localhost identified by '123456' with grant option; 

mysql5.6版本命令

update mysql.user set password=password('123456') where user='root';
flush privileges; #刷新
exit

mysql5.7版本命令

update user set authentication_string=password('123456') where user='root' and Host='localhost';
flush privileges; #刷新
exit

修改密码8.0版本

cat /var/log/mysqld.log | grep localhost  
alter user 'root'@'localhost' identified by 'mima';
flush privileges;
exit

改完后:

vim /etc/my.cnf
#skip-grant-tables  #注释 
systemctl restart mariadb 

mysql登录不上了

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

在这里插入图片描述

ps -ef | grep mysql

在这里插入图片描述

rm /var/run/mysqld/mysqld.sock
ln -s /tmp/mysql.sock /var/run/mysqld/mysqld.sock
service mysqld restart 

本机安装了5.6后,又安装了mysql8.0

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
dpkg -l | grep mysql
#ii  mysql-client-core-8.0                  8.0.37-0ubuntu0.22.04.3                 amd64        MySQL database core client binaries
apt-get remove mysql-client-core-8.0

在这里插入图片描述

systemctl  status mysql
举报

相关推荐

0 条评论