参考地址:

http://www.zhdba.com/mysqlops/2013/08/16/mariadb-cn_1001/

https://mariadb.com/kb/en/mariadb/installing-system-tables-mysql_install_db/

如果您有root权限访问系统,您可能想将MariaDB安装在mysql的用户和组”(安装保持与mysql的兼容性):

groupadd mysql
useradd -g mysql mysql
cd /usr/local
tar -zxvpf /path-to/mariadb-VERSION-OS.tar.gz
ln -s mariadb-VERSION-OS mysql
cd mysql
./scripts/mysql_install_db –user=mysql
chown -R root .
chown -R mysql data

您现在启动mysqld:

./bin/mysqld_safe –user=mysql &
or
./bin/mysqld_safe –defaults-file=~/.my.cnf –user=mysql &

测试连接,修改您的$PATH,这样您就可以调用客户端比如mysql、mysqldump等等。

export PATH=$PATH:/usr/local/mysql/bin/

您可能想要修改您的.bashrc或.bash_profile来固化。

 

------------------------------------------------------------------------------------------

由于登陆使用了如下命令:

shell> ./bin/mysqld_safe --user=root &

导致再次登陆时候使用

shell> ./bin/mysqld_safe --user=MySQL &

报错:

mysqld_safe Logging to '/usr/local/mysql/data/Linux.err'.

mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

mysqld_safe mysqld from pid file /usr/local/mysql/data/Linux.pid ended

 

解决方法:初始化mysql

/usr/local/mysql/scripts/mysql_install_db --user=mysql

 

可以成功登陆

 

如果还报错:

./scripts/mysql_install_db --no-defaults --basedir=. --datadir=data
posted on 2017-03-24 16:20  袁晓平  阅读(744)  评论(0编辑  收藏  举报