Compile and install MariaDB-10.0.20 under CentOS 6.6
System Environment: CentOS6.6 (Final)
MariaDB port: 3309 (because MySQL is already installed on the local machine and you do not want to delete MySQL)
# Wget http://mariadb.nethub.com.hk//mariadb-10.0.20/source/mariadb-10.0.20.tar.gz
Create mariadb user
# Groupadd-r mariadb
# Useradd-g mariadb-r-M-s/sbin/nologin mariadb // This mariadb user cannot log on
Dependent components
# Yum-y install gcc-c ++ make cmake ncurses libxml2 libxml2-devel openssl-devel bison-devel
# Tar zxvf mariadb-10.0.20.tar.gz
# Cd mariadb-10.0.20
# Cmake. -DMYSQL_UNIX_ADDR =/tmp/mariadb. sock-DSYSCONFDIR =/home/local/mariadb-keys = 3309-DEXTRA_CHARSETS = all-DMYSQL_USER = mariadb-DCMAKE_INSTALL_PREFIX =/home/local/mariadb-keys =/home/data/mariadb -cores = 1-cores = 1-cores = 1-cores = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1-cores = 1-cores = 1-DWIYH_READLINE = 1-DWIYH_SSL = system-DVITH_ZLIB = system -DWITH_LOBWRAP = 0-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci
# Make-j 4
# Make install
Add the MariaDB service to the system environment variable: Add the following line at the end.
# Vim/etc/profile
Export PATH = $ PATH:/home/local/mariadb/bin
# Source/etc/profile
Copy the configuration file
# Cp/home/local/mariadb/support-files/my-large.cnf/home/local/mariadb/my. cnf
Initialize Database
#/Home/local/mariadb/scripts/mysql_install_db -- basedir =/home/local/mariadb -- datadir =/home/data/mariadb -- user = mariadb -- defaults-file =/home /local/mariadb/my. cnf
Copy Service Startup Script
# Cp/home/local/mariadb/support-files/mysql. server/etc/init. d/mariadb
# Vim/etc/init. d/mariadb
Find
$ Bindir/mysqld_safe -- datadir = "$ datadir" -- pid-file = "$ mysqld_pid_file_path" $ other_args>/dev/null 2> & 1 &
Line, changed
$ Bindir/mysqld_safe -- defaults-file =/home/local/mariadb/my. cnf -- datadir = "$ datadir" -- pid-file = "$ mysqld_pid_file_path" $ other_args>/dev/null 2> & 1 &
-- Defaults-file =/home/local/mariadb/my. cnf is added.
Save and exit
# Chmod + x/etc/init. d/mariadb
# Chkconfig mariadb on
Configure/home/local/mariadb/my. cnf
Add the following lines in the [mysqld] module:
Log-error =/home/logs/mariadb_error.log
Pid-file =/home/local/mariadb. pid
User = mariadb
Datadir =/home/data/mariadb
Basedir =/home/local/mariadb
New mysqld_safe Block
[Mysqld_safe]
Log-error =/home/logs/mariadb_error.log
Pid-file =/home/local/mariadb. pid
Directory permission before startup
# Chown-R mariadb: mariadb/home/data/mariadb
# Chown-R mariadb: mariadb/home/data/mariadb /.
# Chown-R mariadb: mariadb/home/local/mariadb
# Chown-R mariadb: mariadb/home/local/mariadb /.
Start MariaDB:
#/Etc/init. d/mariadb start
Note: If the startup fails, check the/home/logs/mariadb_error.log file to see what error is reported. correct the error.
Set the root password
#/Home/local/mariadb/bin/mysqladmin-u root password '123'
Go to the MariaDB shell
[Root @ localhost mariadb] #/home/local/mariadb/bin/mysql-u root-p
Enter password:
Welcome to the MariaDB monitor. Commands end with; or \ g.
Your MariaDB connection id is 4
Server version: 10.0.20-MariaDB Source distribution
Copyright (c) 2000,201 5, Oracle, MariaDB Corporation AB and others.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
MariaDB [(none)]> show engines \ G;
* *************************** 1. row ***************************
Engine: InnoDB
Support: DEFAULT
Comment: Percona-XtraDB, Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
* *************************** 2. row ***************************
Engine: MRG_MyISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
* *************************** 3. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
* *************************** 4. row ***************************
Engine: BLACKHOLE
Support: YES
Comment:/dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
* *************************** 5. row ***************************
Engine: MyISAM
Support: YES
Comment: MyISAM storage engine
Transactions: NO
XA: NO
Savepoints: NO
* *************************** 6. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
* *************************** 7. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
* *************************** 8. row ***************************
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
* *************************** 9. row ***************************
Engine: FEDERATED
Support: YES
Comment: FederatedX pluggable storage engine
Transactions: YES
XA: NO
Savepoints: YES
* *************************** 10. row ***************************
Engine: Aria
Support: YES
Comment: Crash-safe tables with MyISAM heritage
Transactions: NO
XA: NO
Savepoints: NO
10 rows in set (0.00 sec)
ERROR: No query specified
MariaDB [mysql]> use mysql; // select the system database mysql
MariaDB [mysql]> select Host, User, Password from user; // view all users
MariaDB [mysql]> delete from user where password = "";
MariaDB [mysql]> grant all privileges on *. * TO root @ "%" identified by '000000'; // Add remote connection capability for root
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> select Host, User, Password from user; // check whether all users whose passwords are empty have been deleted.
MariaDB [mysql]> exit;
Set a firewall so that other servers in the LAN can access
Vi/etc/sysconfig/iptables
-A input-m state -- state NEW-m tcp-p tcp -- dport 3309-j ACCEPT
/Etc/init. d/iptables restart
Linux Tutorial: How to check the MariaDB server version
Implementation of MariaDB Proxy read/write splitting
How to compile and install the MariaDB database in Linux
Install MariaDB database using yum in CentOS
Install MariaDB and MySQL
How to migrate MySQL 5.5 database to MariaDB 10 on Ubuntu
Install MariaDB on the Ubuntu 14.04 (Trusty) Server