CentOS7 虚拟机安装mysql5.6

查看mysql软件
rpm -qa|gref mysql
卸载mysql
yum remove -y mysql mysql-libs mysql-common
rm -rf /var/lib/mysql
rm /etc/my.cnf
安装mysql
wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-communiti-release-el6-5.noarch.rpm
yum install -y mysql-community-server
配置mysql
vim /etc/my.cnf
修改内容如下
lower_case_table_names=1
#default-character-set=utf8

datadir=/var/lib/mysql
basedir=/usr/local/mysql

启动mysql
systemctl start mysqld
报错
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

查看错误日志
vi /var/log/mysqld.log

2019-12-05 11:43:00 45464 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
2019-12-05 11:43:00 45464 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2019-12-05 11:43:00 45464 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-12-05 11:43:00 45464 [Note] InnoDB: The InnoDB memory heap is disabled

解决办法
1./usr/bin/mysql_install_db --user=mysql 


# 报错
FATAL ERROR: Neither host 'localhost.localdomain' nor 'localhost' could be looked up with
/usr/local/mysql/bin/resolveip
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option

2. 查看hosts
cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1   localhost localhost.localdomain localhost6 localhost6.localdomain6

3. 重新/usr/bin/mysql_install_db --user=mysql
还是报错
4.按照第一步提示加上--force 
/usr/bin/mysql_install_db --user=mysql --force
成功

重新启动mysql
systemctl start mysqld
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值