linux mysql ip登录失败,mysql root 无法在 linux 本地登陆

mysql 授权 1.让用户在所有ip都可以登录 GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; flush privileges; 2.让用户在指定ip可以登录 GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; flush privileges; 3.如果用户无法从本地登陆,这个时候就执行如下 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost.localdomain' IDENTIFIED BY '123456' WITH GRANT OPTION; flush privileges; 4.如果用户依然无法从本地登陆,这个时候就执行如下 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION; flush privileges; 5.如果还无法本地登陆,并且报错是无法找到 mysql.sock 文件,需要修改一下 my.cnf 文件 添加如下内容: [mysql.server] user=mysql basedir=/opt/tools/mysql [client] #这个是 sock 文件位置 socket=/opt/tools/mysql/mysql.sock 完整的 my.cnf 文件配置 [mysqld] #datadir=/var/lib/mysql #socket=/var/lib/mysql/mysql.sock datadir=/opt/tools/mysql socket=/opt/tools/mysql/mysql.sock user=mysql default-character-set=utf8 log-slow-queries = /opt/logs/mysql/slowquery.log long_query_time = 1  #单位是秒 log-queries-not-using-indexes # Disabling symbolic-links is recommended to prevent assorted security risks set-variable=max_connections=1000 max_allowed_packet=20M innodb_buffer_pool_size=1G # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysql.server] user=mysql basedir=/opt/tools/mysql [client] socket=/opt/tools/mysql/mysql.sock [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值