Mysql Job failed to start

本文提供了一种解决MySQL服务启动失败的方法,包括备份数据、卸载MySQL、清除配置文件夹、检查并恢复数据库文件等步骤,并介绍了如何使用mysql_upgrade命令修复数据结构错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I got an error while am up starting the mysql service.

/etc/init.d/mysql start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql start

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
start: Job failed to start




First, try to reboot the server (if it doesn't work, follow to the next steps):
sudo reboot


Other steps:
First, create a backup from you MySQL folder var/lib/mysql/, just to make sure your data will be safe:

sudo -i
cp -R /var/lib/mysql/ ~/mysql
After that, remove/purge MySQL (this will remove: php5-mysql, phpmyadmin and other libraries, so after the procedure, you will have to reinstall again.

sudo apt-get purge mysql-server-5.1 mysql-common

Remove the folder /etc/mysql/ and its content:

sudo rm /etc/mysql/ -R

Later on, check if the database files are still in the folder /var/lib/mysql/ and if they are not, then copy it back:

mkdir /var/lib/mysql/
chown root:root /var/lib/mysql/ -R
cd ~/mysql/
cp * /var/lib/mysql/ -R

Okay, then install o mysql server again

apt-get install mysql-server

And finally install phpmyadmin and php5-mysql:

apt-get install php5-mysql
apt-get install phpmyadmin

At last, restart the services and check if the status are okay now:

service apache2 restart
service mysql restart

That's it! It should work. I hope it works for you! (don't worry about the old data.That's why we have backup it first)

mysql报错:

ERROR 3009 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. Created with MySQL 50554, now running 50719. Please use mysql_upgrade to fix this error

错误是由于你曾经升级过数据库,升级完后没有使用
mysql_upgrade升级数据结构造成的。
解决办法:
使用mysql_upgrade命令

root@localhost ~]# mysql_upgrade -u root -p 13456
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值