mysql安装初始化操作报错“FATAL ERROR: Could not find mysqld”

问题描述:在安装mysql,进行初始化操作的时候报错“FATAL ERROR: Could not find mysqld”

mysql版本:5.5.11

具体报错:
# cd /usr/local/mysql-5.5.11-linux2.6-x86_64
# ./scripts/mysql_install_db --defaults-file=/etc/my_mob.cnf  --user=mysql

FATAL ERROR: Could not find mysqld

The following directories were searched:

    /usr/local/mysql/libexec
    /usr/local/mysql/sbin
    /usr/local/mysql/bin

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

原因分析:
这里初始化搜索的路径是 /usr/local/mysql/bin,但实际应该是/usr/local/mysql-5.5.11-linux2.6-x86_64
配置文件中mysql基目录是/usr/local/mysql,但实际是/usr/local/mysql-5.5.11-linux2.6-x86_64,修改配置文件可以解决
当然,我们如果没有其他版本的mysql在当前服务器上,可以创建软连接(/usr/local/mysql --->/usr/local/mysql-5.5.11-linux2.6-x86_64)也是可以的。

解决方法:修改配置文件
#vi /etc/my_mob.cnf

basedir=/usr/local/mysql --->   /usr/local/mysql-5.5.11-linux2.6-x86_64


参考文档:https://mariadb.com/kb/en/mariadb/documentation/getting-started/troubleshooting-installation-issues/mariadb-fatal-error-could-not-find-mysqld-when-run-the-script-scriptsmysql_/

你可能感兴趣的:(MySQL)