Centos6.8上安裝mariadb10.1.26

mariadb包下載:[下載地址]

安裝步驟:
1.新建用戶

[root@localhost scripts]# groupadd mysql
[root@localhost scripts]# useradd mysql -g mysql
[root@localhost scripts]# passwd mysql
更改用戶 mysql 的密碼 。
新的 密碼:
重新輸入新的 密碼:
passwd: 所有的身份驗證令牌已經(jīng)成功更新。

2.上傳解壓
上傳到/app下,因為我的安裝目錄是/app

[root@localhost app]# tar -xvf mariadb-10.1.26-linux-x86_64.tar.gz
[root@localhost app]# mv mariadb-10.1.26-linux-x86_64 mariadb-10.1.26

3.初始化數(shù)據(jù)庫軟件

[root@localhost app]# cd mariadb-10.1.26
[root@localhost mariadb-10.1.26]# cd scripts/
[root@localhost scripts]# ./mysql_install_db --user=mysql --basedir=/app/mariadb-10.1.26 --datadir=/app/mariadb-10.1.26/data

4.拷貝配置文件

[root@localhost scripts]# cd ../support-files/
[root@localhost support-files]# cp my-large.cnf /etc/my.cnf
cp:是否覆蓋"/etc/my.cnf"? y
[root@localhost support-files]# cp mysql.server /etc/init.d/mysql

5.啟動服務(wù)

[root@localhost support-files]# cd /app
[root@localhost app]# chown mysql:mysql -R mariadb-10.1.26

vi /etc/init.d/mysql
補齊如下兩行內(nèi)容:

basedir=
datadir=
改至:
basedir=/app/mariadb-10.1.26
datadir=/app/mariadb-10.1.26/data

起服務(wù)

[root@localhost app]# service mysql start
Starting MySQL.170721 23:39:19 mysqld_safe Logging to '/app/mariadb-10.1.26/data/localhost.centos1.err'.
170721 23:39:19 mysqld_safe Starting mysqld daemon with databases from /app/mariadb-10.1.26/data
[確定]

6.配置root賬戶信息

[root@localhost app]# cd mariadb-10.1.26/bin
[root@localhost bin]# vi mysql_secure_installation

找到/usr/local/bin字段,只有兩處,連在一起的
兩行內(nèi)容如下:

  print_defaults="/usr/local/mysql/bin/my_print_defaults"
  mysql_command="/usr/local/mysql/bin/mysql"
改至:
  print_defaults="/app/mariadb-10.1.26/bin/my_print_defaults"
  mysql_command="/app/mariadb-10.1.26/bin/mysql"

執(zhí)行如下命令:

[root@localhost bin]# ./mysql_secure_installation 

除了輸密碼時輸入,其他都回車即可。

vi /etc/profile,加入這兩行

export MYSQL_HOME="/app/mariadb-10.1.26"
export PATH="$PATH:$MYSQL_HOME/bin"

添加后重載下變量: . /etc/profile

測試root賬號是否可用:

[root@localhost bin]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.1.26-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> 

7.用普通用戶啟動

[root@localhost bin]# service mysql stop
Shutting down MySQL...[確定]
[root@localhost bin]# su - mysql
[mysql@localhost ~]$ service mysql start
Starting MySQL.170721 23:54:34 mysqld_safe Logging to '/app/mariadb-10.1.26/data/localhost.centos1.err'.
170721 23:54:34 mysqld_safe Starting mysqld daemon with 
databases from /app/mariadb-10.1.26/data
[確定]

查看進程

[mysql@localhost ~]$ ps -ef|grep mysql
root      44551  16323  0 23:54 pts/4    00:00:00 su - mysql
mysql     44587      1  0 23:54 pts/4    00:00:00 /bin/sh /app/mariadb-10.1.26/bin/mysqld_safe --datadir=/app/mariadb-10.1.26/data --pid-file=/app/mariadb-10.1.26/data/localhost.centos1.pid
mysql     44715  44587  2 23:54 pts/4    00:00:00 /app/mariadb-10.1.26/bin/mysqld --basedir=/app/mariadb-10.1.26 --datadir=/app/mariadb-10.1.26/data --plugin-dir=/app/mariadb-10.1.26/lib/plugin --log-error=/app/mariadb-10.1.26/data/localhost.centos1.err --pid-file=/app/mariadb-10.1.26/data/localhost.centos1.pid --socket=/tmp/mysql.sock --port=3306

配置galera集群:http://www.itdecent.cn/p/52676b0e313f

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容