白天的影子

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

编译安装MariaDB 10.4.7,前面的步骤我就不复述了,一切正常没什么问题。

当执行到:scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql,这时系统提示以下错误:

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.

又是百度又是google的,半天也没解决问题,最后研究了代码,才有了下面的解决方案:

1、可以切换到源码目录,例如:/data/mariadb-10.4.7

cd /data/mariadb-10.4.7

2、修改 mysql_install_db 文件:

vim /data/mariadb-10.4.7/scripts/mysql_install_db

在 323 行附近,找到代码:

# Configure paths to support files
if test -n "$srcdir"
  then
......

部分,在下面增加为变量 builddir 赋值,结果如下:

  builddir='/data/mariadb-10.4.7' #******* 赋值 *******
  basedir="$builddir"
  bindir="$basedir/client"
  resolveip="$basedir/extra/resolveip"

3、继续向下,在 363 行附近,找到代码:

  plugindir=`find_in_dirs --dir auth_pam.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
  pamtooldir=$plugindir #***** 就是这行 ******
# relative from where the script was run for a relocatable install
elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "./bin/mysqld"

我们在 pamtooldir=$plugindir 一行的下面,增加新行,覆盖原先的值,结果为:

  plugindir=`find_in_dirs --dir auth_pam.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
  pamtooldir=$plugindir
  pamtooldir='./plugin/auth_pam' #******* 新增行 *******
# relative from where the script was run for a relocatable install
elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "./bin/mysqld"

保存,退出。

4、确定当前是在源码目录下,即:/data/mariadb-10.4.7/ ,直接执行命,就OK了。

./scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql #参数 --basedir 和 --datadir ,自行设定,照抄我的不一定好使~

破饭,收摊。

posted on 2019-08-21 16:59  白天的影子  阅读(4029)  评论(0编辑  收藏  举报