MySQL出错问题解决

之前用yum安装过一次MySQL,后来用rpm卸载了,还删除了所有的配置文件什么的,总之就是MySQL在我的Linux中清理得毫!无!痕!迹!然后。。。最近要使用MySQL了,于是我又用yum安装了一遍,但是安装好后service mysqld start失败了。。。谁让我这么折腾呢!
报错信息是这样的:

/usr/bin/mysqladmin: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
Cannot check for MySQL Daemon startup because of mysqladmin failure.
Starting mysqld:                                      [FAILED]

于是速去百度,大神们让我:

yum remove mysql-libs   #卸载

yum install -y mysql-libs   #在安装

于是我右卸载重装了一遍(微笑脸)
没想到!!!还是启动失败。。。
less /var/log/mysqld.log查看了MySQL的log文件,竟然有报错。。。
这次报错是这样的:

170803 21:57:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
170803 21:57:18 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

我又速去百度,大神说错误的意思是说安装mysql数据库后默认的表结构没有初始化,所以当你启动mysqld时,会提示说 Table ‘mysql.plugin’ doesn’t exist。因此,我们需要把mysql的默认数据结构初始化下,具体解决办法如下:

/usr/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql

我在终端输入了上述语句,MySQL终于能正常启动了!

[root@localhost bin]# service mysqld start
Starting mysqld:                                       [  OK  ]
[root@localhost bin]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.03 sec)

mysql> quit
Bye

感谢生活在互联网这么发达的二十一世纪~~~~

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值