Mysql 整理错误
Mysql 启动报PID错误
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
Starting MySQL..ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@localhost ~]# cd /usr/local/mysql [root@localhost mysql]# chown -R mysql.mysql . [root@localhost mysql]# su - mysql [mysql@localhost ~]$ cd /usr/local/mysql [mysql@localhost mysql]$ scripts/mysql_install_db
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
# 将PID所在路径,权限设置777 chomod 777 /data/mysql
Mysql 登陆验证错误
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
方法操作很简单,如下: /etc/init.d/MySQL stop mysqld_safe --user=mysql --skip-grant-tables --skip-networking & mysql -u root mysql mysql>use mysql ; mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='root' or host='localhost';//把空的用户密码都修改成非空的密码就行了。 mysql> FLUSH PRIVILEGES; mysql> quit # /etc/init.d/mysqld restart mysql -uroot -p Enter password: <输入新设的密码newpassword>
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
# 1、修改配置文件 vim /etc/my.cnf # 无需验证mysql登陆 skip-grant-tables # 2、重启mysql /etc/init.d/mysqld restart # 3、进入mysql修改root密码 mysql> use mysql; mysql> update user set password=password("你的新密码") where user="root"; mysql> flush privileges; mysql> quit # 4、去除配置文件skip-grant-tables字段、重启 /etc/init.d/mysqld restart
Mysql 反解析登陆错误
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
Lost connection to Mysql server at 'waiting for initial communication packet'
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
# my.cnf配置的几个参数: skip-name-resolve 跳过DNS反向解析过程.(这样就不能使用主机名连接mysql了,只能使用ip连接) skip-grant-tables 跳过授权表(当mysql登陆密码忘记时的解决办法) skip-networking 跳过TCP/IP连接 skip-host-cache 禁用主机名缓存;要想清除主机名缓存,执行FLUSH HOSTS语句或执行mysqladmin flush-