MariaDB installation steps

Don't gossip, go straight to the dry goods...

 

1. Download the installation package

 

10.1.16 is the stable release:

http://ftp.hosteurope.de/mirror/archive.mariadb.org//mariadb-10.1.16/source/mariadb-10.1.16.tar.gz

 

 

2. Select the installation location and extract it

Installation location /usr/local/mysql

tar -xvf mariadb-galera-10.0.15-linux-x86_64.tar.gz -C /usr/local/

Create soft link

cd /usr/local

ln -s mariadb-galera-10.0.15-linux-x86_64 mysql

 

3. Install user creation

 

# userdel mysql

# groupadd -g 27 mysql

# useradd -u 27 -g 27 -d /usr/local mysql

 

4. Permission modification

 

cd /usr/local

# chown -R mysql:root mariadb-galera-10.0.15-linux-x86_64

# chmod -R 755 mariadb-galera-10.0.15-linux-x86_64

 

5. Configuration file editing

 

#cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

 

vi /etc/my.cnf

[mysqld]

datadir= XXX #The data directory needs to be set by yourself ( according to the mounting situation, generally choose /data/mysql)

 

character_set_server=utf8

max_connections=200

lower_case_table_names = 1

max_connect_errors = 100000

innodb_file_format = barracuda

innodb_file_per_table = true

innodb_large_prefix = true

expire_logs_days=30

 

6. Database installation

 

# su - mysql

$ cd mysql

$ ./scripts/mysql_install_db

$ exit

 

7. Add startup files, environment variables, etc.

 

Add startup items:

# cd /etc/init.d

# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

#chmod +x mysqld

#chkconfig --del mysqld

#chkconfig --add mysqld

 

#set startup

#chkconfig mysqld on

 

Add environment variables:

 

# vi /etc/profile

Add the following

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

export PATH

Run the source command to make the environment variable take effect.

# source /etc/profile

 

8. Start

 

service mysqld start

 

9. Configuration

 

Log in:

# mysql -u root -p

Enter password: ----The password here is empty         

 

 

Remove empty user and set password:

mysql> DELETE FROM mysql.user WHERE User = '';

mysql> update mysql.user set password=password("abcde@mysqlsit") where user="root";

 

设置登录权限:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '******' WITH GRANT OPTION;

 

刷新权限:

mysql> flush privileges;

 

可退出后重新验证登陆。

 

10、用户设置标准

 

需要根据具体数据库设置相应用户及权限。

 

11、配置主从时忽略的数据库

 

###Ignore DB

replicate-ignore-db = mysql

replicate-ignore-db = information_schema

replicate-ignore-db = performance_schema

replicate-ignore-db = test

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326523965&siteId=291194637