Mysql 启动报PID错误
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
Starting MySQL..ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.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://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
# 将PID所在路径,权限设置777 chomod 777 /data/mysql
Mysql 登陆验证错误
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.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://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.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