Objective
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,10.0.9版起使用XtraDB(名称代号为Aria)来代替MySQL的InnoDB。MariaDB由MySQL的创始人麦克尔·维德纽斯主导开发,MariaDB名称来自麦克尔·维德纽斯的女儿玛丽亚(英语:Maria)的名字。MariaDB直到5.5版本,均依照MySQL的版本。因此,使用MariaDB5.5的人会从MySQL 5.5中了解到MariaDB的所有功能。
System Platform:
CentOS Release 6.9 (Final)
Kernel 2.6.32-696.el6.x86_64
1. Go to the official website to download the appropriate binary package
http://mariadb.org/
Mariadb-5.5.59-linux-x86_64.tar.gz
Check that the database is installed in the system.
#rpm -qa|grep MariaDB#rpm -qa|grep mysql
2. Create MySQL group and account
#groupadd -g 500 mysql#useradd -u 500 -g mysql -s /sbin/nologin -M mysql
3. Unpack the package to/usr/local
#tar xvf mariadb-5.5.58-linux-x86_64.tar.gz -C /usr/local/
4. Create a soft link MySQL point to the extracted directory
#cd /usr/local/#ln -s mariadb-5.5.58-linux-x86_64/ mysql
5. Modify the MySQL folder owner and owning group
#chown -R mysql.mysql mysql/
6. Add path to environment variable
#echo ‘PATH=/usr/local/mysql/bin:$PATH‘ >> /etc/profile.d/mysql.sh检查文件#cat /etc/profile.d/mysql.sh加载环境变量文件 并检查#source /etc/profile.d/mysql.sh#echo $PATH
7. Create a database Hosting folder and Modify permissions
#mkdir -pv /data/mysqldb/3306#chown -R mysql.mysql /data/mysqldb/#chmod -R 770 /data/mysqldb
8. Copy the Master profile my.cnf
This is the first to confirm how much memory is in the machine so that you can use a reference template.
#grep memory support-files/*
Find a template for native memory
The native memory is 256M, so the my-large.cnf configuration file is selected
#\cp support-files/my-large.cnf /data/mysqldb/3306/my.cnf
9. Modify the configuration file
#vim /data/mysqldb/3306/my.cnf
Find [mysqld] This configuration item,
Add our well-defined database directory
[mysqld]datadir = /data/mysqldb/3306
10. Installing database-related files
# cd /usr/local/mysql
To view the installation parameters for the installation program
#./scripts/mysql_install_db --help
The following command must be executed within this folder, or the following error will be reported
FATAL ERROR: Could not find ./bin/my_print_defaults./scripts/mysql_install_db --datadir=/data/mysqldb/3306 --user=mysql --defaults-file=/data/mysqldb/3306/my.cnf --skip-name-resolve参数说明 :指定此实例的配置文件,跳过DNS解析
The presence of 2 OK means that the installation is normal.
11. Copy start service script to/etc/init.d directory
#cp support-files/mysql.server /etc/init.d/mysqld
12. Modify the startup script to specify parameters
因为本次安装自定义了非默认的位置,所以有些参数是需要对应修改的#vim /etc/init.d/mysqlda.找到这个位置,修改为创建的数据目录if test -z "$datadir" then datadir=/data/mysqldb/3306 #修改为这一行b.找到这个位置,修改为新的配置文件路径。默认设定为/etc/my.cnf# Try to find basedir in /etc/my.cnf conf=/data/mysqldb/3306/my.cnf #修改为这一行
13. Add Boot Boot
#chkconfig --add mysqld#chkconfig --list mysqldmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
14. Start the MySQL service
#service mysqld startStarting MySQL.180123 00:58:39 mysqld_safe Logging to ‘/data/mysqldb/3306/centos6.hunk.teh.err‘.180123 00:58:39 mysqld_safe Starting mysqld daemon with databases from /data/mysqldb/3306. [ OK ]
15. Check the Confirmation
Check if Port 3306 is turned on
#ss -ntl | grep 3306LISTEN 0 50 *:3306 *:*
Confirm version
#mysql -Vmysql Ver 15.1 Distrib 5.5.59-MariaDB, for Linux (x86_64) using readline 5.1
16. Make the Security Configuration
#/usr/local/mysql/bin/mysql_secure_installationEnter current password for root 默认为空Set root password 设置mysql root密码Remove anonymous users 是否移除匿名用户登录Disallow root login remotely 是否禁止root远程登录Remove test database and access to it? 是否移除test数据和test账号Reload privilege tables now? 是否立即更新权限Thanks for using MariaDB!
17. Client Connection
#mysql -uroot -pEnter password: Welcome to the MariaDB monitor.
At this point, the mariadb binary installation is complete for rapid deployment.
Please continue to focus on other ways to install.
CentOS 6 Custom Single-instance binary installation mariadb-5.5.59