mysql root 无法在 linux 本地登陆
2015-07-20 14:20
363 查看
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
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
相关文章推荐
- linux下的小工具和小常识
- 在Linux中如何安装gcc
- centos6.5更改为163的yum源
- CentOS 7.1 1503 U盘安装手记
- 如何让Linux下非root用户程序使用小于1024端口
- Linux文件类型分类
- linux下rtl8188 驱动编译 出现类似 create_proc_entry daemonize 错误问题解决
- Linux下添加新硬盘,分区及挂载
- linux 命令 连接ftp服务器
- CentOS(三)--Weblogic安装
- Linux常用命令
- linux kernel threaded irq
- Linux PCIe SSD NVME 性能调优篇
- centos 安装nodejs
- 嵌入式文件系统ext2、ext3、vfat、ntfs、iso9660、jffs、romfs和nfs等介绍
- linux下面的xdebug安装
- centos安装jdk
- CentOS 中 YUM 安装桌面环境
- linux挂载设备mount使用说明
- Linux的netstat命令