linux安装MYSQL遇到的问题

####启动MYSQL服务时出现无法创建/var/log/mariadb/mariadb.log
错误信息:
Starting MySQL.touch: cannot touch ‘/var/log/mariadb/mariadb.log‘: No such file or directory
chmod: cannot access ‘/var/log/mariadb/mariadb.log‘: No such file or directory
touch: cannot touch ‘/var/log/mariadb/mariadb.log‘: No such file or directory
chown: cannot access ‘/var/log/mariadb/mariadb.log‘: No such file or directory
/usr/local/mysql/bin/mysqld_safe: line 129: /var/log/mariadb/mariadb.log: No such file or directory
/usr/local/mysql/bin/mysqld_safe: line 166: /var/log/mariadb/mariadb.log: No such file or directory
touch: cannot touch ‘/var/log/mariadb/mariadb.log‘: No such file or directory
chown: cannot access ‘/var/log/mariadb/mariadb.log‘: No such file or directory
chmod: cannot access ‘/var/log/mariadb/mariadb.log‘: No such file or directory
/usr/local/mysql/bin/mysqld_safe: line 129: /var/log/mariadb/mariadb.log: No such file or directory
ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).

解决方法:
1 mkdir /var/log/mariadb
2 chmod 700 /var/log/mariadb

####本地连接数据库时出现找不到mysql.sock
错误提示:
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock

解决:
mysql.sock是一个临时文件,在mysql服务启动时会自动生成
用find命令可以找到mysql.sock文件,只不过不在/tmp目录下而已
[root@localhost /]# find / -name mysql.sock
/var/lib/mysql/mysql.sock
解决方法:
建立软连接到/tmp目录下:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock


Linux下安装MySQL5.6

你可能感兴趣的:(Linux)