首先我大概描述一下安装过程:
安装过程大致相同,根据自己实际安装环境而定,为以下启动时报错做一下铺垫,可忽略参考:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
//Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
然后我们启动服务时发现以下报错提示:
Starting MariaDB ERROR! Couldn't find MariaDB server (/usr/local/mysql/bin/mysqld_safe)
解决方法:
我们可修改从加压文件中拷贝到/etc/init.d/mysqld.server 路径中的启动文件,手动指向mysqld_safe文件的所在绝对路径
将/etc/init.d/mysql.server中的“basedir”更改为: basedir=/usr/local/mysql 即可。
在次使用/etc/init.d/mysql.server start 启动成功。如果提醒
[root@localhost ]# /etc/init.d/mysql.server start
Warning: mysqld.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[root@localhost ]# systemctl daemon-reload
即可解决问题。