1. Add the user identity of the database runtime
Groupadd-r-G 306 mysqluseradd-r-u 306-g 306 mysql
2. Unzip and place in the specified position/usr/local
TAR-ZXVF mariadb-5.5.46-linux-x86_64.tar.gzmv mariadb-5.5.46 && mv Mariadb-5.5.46/usr/local/mysql
Modify permissions to ensure security
Chown-r Root:mysql/usr/local/mysql
3. Create a separate database directory to hold the database!
Mkdir/mysqldatachown-r Mysql:mysql/mysqldata
4. Preparing the configuration file
Cp/usr/local/mysql/support-files/my-small.cnf/etc/my.cnf
MySQL config file has/etc/my.cnf--->/etc/mysql/my.cnf---->~./my.cnf
The reading order is from left to right, and the priority is incremented successively! That is, if the ~./my.cnf is in conflict with the first 2 configurations, the ~./MY.CNF will prevail
Why are there so many configuration files? How do I configure it?
The MySQL process can run under a different user identity, often also called a different MySQL instance.
If you run only one DB instance on the server, you only need to prepare/ETC/MY.CNF
If you have more than one MySQL instance, you can configure global options under/ETC/MY.CNF, while ~./MY.CNF is configured for that instance individually
There are a number of best practice configuration files available for reference in Support-files
5. Preparing Environment variables
Export Path=/usr/local/mysql/bin: $PATH
Because it is a generic binary package, there is no environment variable written to it. While some of the configuration files in MySQL use relative paths, and for the convenience of directly invoking the files under/usr/local/mysql/bin, it is recommended to add the MySQL directory to the environment variable. This is a temporary modification, to be restarted is also effective, please write to/etc/profile or resolve yourself.
6. Initializing the database
/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/mysqldata
Please note that you must indicate--basedir otherwise this will occur during initialization:
FATAL ERROR: Could not find./bin/my_print_defaults
Because the init script uses the relative Basedir path, of course you can edit the script yourself.
7. Add to service startup, and start mysqld
Cp/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqldchkconfig-add Mysqldservice mysqld Start
8. Modify the/ETC/MY.CNF configuration file
VIM/ETC/MY.CNF[MYSQLD] Datadir=/mysqldata ...
9. ann full initialization
The binary package provides us with a security initialization script in the/usr/local/mysql/bin/mysql_secure_installation
Because the environment variables have been added before, they can be started directly using Mysql_secure_installation.
Please pay attention to the security initialization, need mysqld service to start after the normal!!
This article is from the "Blue Warehouse" blog, be sure to keep this source http://bluebox.blog.51cto.com/8852456/1708021
MARIADB Universal Binary Deployment Manual