mysql安装常见错误

首先要记住的是mysql的报错之后,就去看mysql的错误日志,二进制安装时默认情况下,mysql的错误日志是在/var/log/mysql/error下;源码安装时,就要看my.cnf里的配置如:log_error = /mysql/log/mysql-error.log;

错误一:Starting MySQL..The server quit without updating PID file

网上都有一些处理方法,但最好先去看看错误日志mysql-error.log;

我遇到的错误日志为:

2017-08-10 09:17:37 4979 [Note] InnoDB: Completed initialization of buffer pool

2017-08-10 09:17:37 4979 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 32000 pages, max 0 (relevant if non-zero) pages!

2017-08-10 09:17:37 4979 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!

2017-08-10 09:17:37 4979 [ERROR] Plugin 'InnoDB' init function returned error.

2017-08-10 09:17:37 4979 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

2017-08-10 09:17:37 4979 [ERROR] Unknown/unsupported storage engine: InnoDB

2017-08-10 09:17:37 4979 [ERROR] Aborting

这个错误一般是因为ibdata1默认参数被修改了;可以删除ibdata1、ib_logfile0、ib_logfile1文件

二进制安装时执行删除命令:rm -rf /var/lib/mysql/ib*

或者删除data目录下的ibdata1、ib_logfile0、ib_logfile1

错误二:[ERROR] --initialize specified but the data directory has files in it. Aborting.

如果初始化失败或者报以上错误,就需要先清空你的/data/mysql目录(或mysql数据目录 )了,因为mysql目录下面有数据所以初始化执行中止。

错误三:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

1、检查一下你启动数据库成功没  可执行  ps -ef | grep mysql  看看进程是不是启动状态

2、检查是否存在这个文件

可以通过修改/etc/my.cnf,让mysql和mysqld服务重启生成一个新的mysql.sock文件,确认新目录的权限正常;即可解决

或者

针对mysql登录时的报错,进入到‘/usr/local/mysql’目录下,找到my.cnf文件打开,在最后一行下面加入一下内容,因为“[mysqld]”是针对服务端进行设置,[mysql]”是针对客户端访问进行设置;

[mysql]

socket=/var/lib/mysql/mysql.sock

port=3306

错误四:Starting MySQL.2018-07-05T17:51:05.242832Z mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists.

ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).

检查一下/etc/my.cnf的配置;

确保

datadir=/usr/local/mysql/data

socket=/tmp/mysql.sock

 

log-error=/var/log/mariadb/mariadb.log

pid-file=/var/run/mariadb/mariadb.pid

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值