標籤:
- 下載mariadb :https://downloads.mariadb.org/ 我選擇mariadb-10.0.20-linux-x86_64.tar.gz這個版本
- 複製安裝檔案 /opt 目錄下 並解壓到目前的目錄 tar -zxf mariadb-10.0.20-linux-x86_64.tar.gz
- 把解壓的檔案名稱改為mariadb
- groupadd mysql
- useradd -g mysql mysql
- cd /opt/mariadb
- chown -R mysql:mysql /opt/mariadb/data
- 把mariadb/support-files下的my-medium.cnf複製到mariadb目錄下,並改為my.cnf
- ./scripts/mysql_install_db --defaults-file=./my.cnf //初始化資料庫
- cp support-files/mysql.server /etc/rc.d/init.d/mysqld
- chmod +x /etc/rc.d/init.d/mysqld
- cp support-files/my-large.cnf /etc/my.cnf
- 修改 /etc/rc.d/init.d/mysqld
- basedir=/opt/mariadb
- datadir=/opt/mariadb/data
- service mysqld start
- 修改環境變數 添加mariadb的bin目錄 編輯/etc/profile,添加export PATH=$PATH:/opt/mariadb/bin/
- 修改root使用者密碼 ./bin/mysqladmin -u root password ‘123456‘
- 登入mysql ./bin/mysql -u root -p
- 設定資料庫許可權:
- MySQL [(none)]> use mysql;
- MySQL [mysql]> update user set host=‘%‘ where user=‘root‘ and host=‘127.0.0.1‘;
- MySQL [mysql]> grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant option;
- MySQL [mysql]> flush privileges;
Centos6.5 安裝 MariaDB-10.0.20-linux-x86_64.tar.gz