编译安装MariaDB 10.4及以后的某个版本,前面一切正常,当执行初始化数据库时,即[root@debian-11:mysql]
# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysqldb/3306/data时,报如下错误:
chown: cannot access ‘/auth_pam_tool_dir/auth_pam_tool’: No such file or directory
Couldn’t set an owner to ‘/auth_pam_tool_dir/auth_pam_tool’.
It must be root, the PAM authentication plugin doesn’t work otherwise…
chown: cannot access ‘/auth_pam_tool_dir’: No such file or directory
Cannot change ownership of the ‘/auth_pam_tool_dir’ directory
to the ‘mysql’ user. Check that you have the necessary permissions and try again.
Installing MariaDB/MySQL system tables in ‘/data/mysqldb/3306/data’ …
截图如下:
这些错误信息提示了数据库初始化失败。如何解决这一问题呢?
1.按提示信息创建目录及文件、授权
# mkidr /auth_pam_tool_dir
# touch /auth_pam_tool_dir/auth_pam_tool
# chown -R mysql:mysql /auth_pam_tool_dir
# chmod -R 0770 /auth_pam_tool_dir
2.初始化数据库时指定验证方式
# cd /usr/local/mysql
# ./scripts/mysql_install_db --auth-root-authentication-method=normal --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysqldb/3306/data
此时不会再报错误。截图如下:
好了,其他步骤不多说了…