解决centos7 中 使用mariadb 安装mysql不成功的问题

按照openstack官网的步骤安装openstack

Install and configure components

  1. Install the packages:

    # yum install mariadb mariadb-server python2-PyMySQL
    
  1. Create and edit the /etc/my.cnf.d/openstack.cnf file and complete the following actions:

    • Create a [mysqld] section, and set the bind-address key to the management IP address of the controller node to enable access by other nodes via the management network. Set additional keys to enable useful options and the UTF-8 character set:

      [mysqld]
      bind-address = 10.0.0.11
      
      default-storage-engine = innodb
      innodb_file_per_table = on
      max_connections = 4096
      collation-server = utf8_general_ci
      character-set-server = utf8
      

Finalize installation

  1. Start the database service and configure it to start when the system boots:

    # systemctl enable mariadb.service
    # systemctl start mariadb.service
问题来了,执行 systemctl start mariadb.service后,mariadb服务一直起不来

执行journalctl -xe 查看启动日志,发现

[root@lancoo1 ~]# systemctl status mariadb.service 
● mariadb.service - MariaDB 10.1 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2017-11-07 15:41:32 CST; 10s ago
  Process: 4150 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
  Process: 4134 ExecStart=/usr/libexec/mysqld --basedir=/usr $MYSQLD_OPTS $_WSREP_NEW_CLUSTER (code=exited, status=1/FAILURE)
  Process: 4097 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
  Process: 4074 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 4134 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"


Nov 07 15:41:32 lancoo1 systemd[1]: Starting MariaDB 10.1 database server...
Nov 07 15:41:32 lancoo1 mysql-prepare-db-dir[4097]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Nov 07 15:41:32 lancoo1 mysql-prepare-db-dir[4097]: If this is not the case, make sure the /var/lib/mysql is empty before running mysql-prepare-db-dir.
Nov 07 15:41:32 lancoo1 mysqld[4134]: 2017-11-07 15:41:32 140737353783488 [Note] /usr/libexec/mysqld (mysqld 10.1.20-MariaDB) starting as process 4134 ...
Nov 07 15:41:32 lancoo1 systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Nov 07 15:41:32 lancoo1 systemd[1]: Failed to start MariaDB 10.1 database server.
Nov 07 15:41:32 lancoo1 systemd[1]: Unit mariadb.service entered failed state.
Nov 07 15:41:32 lancoo1 systemd[1]: mariadb.service failed.

上述错误日志表明 mysql 数据库都还没有建立好  所以服务起不来,这根单独 的mysql服务有区别




问题: chown: changing ownership of '/var/lib/mysql': Operation not permitted 

           failed to start mariadb 10.1 database server

1: 发现是权限不够,首先检查防火墙是否开启,发现防火墙没有开

 2:删除原先mysql相关的服务 进程 配置文件

rm -rf /etc/my.cnf

rm -rf /var/lib/mysql/*

rpm -qa |grep mysql 


准备工作 

chown -R  mysql:mysql  /var/lib/mysql

//先初始化数据库

   sudo mysql_install_db --datadir=/home/mysql --user=root --defaults-file=/etc/my.cnf.d/openstack.cnf

//启动服务
   systemctl start mariadb

//查看状态
   systemctl status mariadb.service

给keystone文件777 权限

chmod 777 /etc/keystone/keystone.conf

  • 6
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值