日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > 数据库 >内容正文

数据库

linux系统的数据库是本地吗,Linux下MySQL无法在本地以非root用户身份连接数据库...

發(fā)布時(shí)間:2024/10/8 数据库 134 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux系统的数据库是本地吗,Linux下MySQL无法在本地以非root用户身份连接数据库... 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

標(biāo)題有點(diǎn)羅嗦,目前出現(xiàn)的問(wèn)題如下:

當(dāng)以非root身份登錄數(shù)據(jù)庫(kù)時(shí),會(huì)報(bào)錯(cuò)

mysql -u root -p

Enter password:

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

而使用root身份訪問(wèn)就沒(méi)有問(wèn)題

問(wèn)題探究

查看root用戶使用的認(rèn)證插件:

mysql> select user,plugin from user where user = 'root';

+------+-------------+

| user | plugin |

+------+-------------+

| root | auth_socket |

+------+-------------+

1 row in set (0.00 sec)

MySQL使用的auth_socket是通過(guò)Unix套接字進(jìn)行連接認(rèn)證[1]

The unix_socket authentication plugin works by calling the getsockopt system call with the SO_PEERCRED socket option, which allows it to retrieve the uid of the process that is connected to the socket. It is then able to get the user name associated with that uid. Once it has the user name, it will authenticate the connecting user as the MariaDB account that has the same user name. [2]

因此可以將認(rèn)證插件改為 mysql_native_password

解決方法

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';

FLUSH PRIVILEGES;

另請(qǐng)參閱

[1] https://dev.mysql.com/doc/refman/8.0/en/socket-pluggable-authentication.html

[2] https://mariadb.com/kb/en/authentication-plugin-unix-socket/

標(biāo)簽:socket,plugin,mysql,Linux,以非,user,MySQL,password,root

來(lái)源: https://www.cnblogs.com/ZanyRain/p/12243460.html

總結(jié)

以上是生活随笔為你收集整理的linux系统的数据库是本地吗,Linux下MySQL无法在本地以非root用户身份连接数据库...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。