Install MariaDB (MySQL) on CentOS 6.5)

Source: Internet
Author: User

Install MariaDB (MySQL) on CentOS 6.5)

Install MariaDB (MySQL) on CentOS 6.5)

1. Get the installation package of mariaDB from the official website and put it under the root directory through xftp.

2. Expand the MariaDB File

Tar xf mariadb-5.5.42-linux-x86_64.tar.gz-C/usr/local

3. Help document location


4. Prepare hard disks for database data



Vgcreate mysqlvg/dev/sdb1

Lvcreate-l 1278-n mydata mysqlvg

Mke2fs-t ext4-l mydata-B 4096-m 3/dev/mysqlvg/mydata




5. Add mysql groups and users

# Groupadd-r mysql

# Useradd-g mysql-r mysql

# Id mysql

Uid = 498 (mysql) gid = 498 (mysql) groups = 498 (mysql)

6. Change the owner group of/mydata/data

# Chown-R mysql. mysql/mydata/data

7. Create a soft link for the mysql folder

# Ln-sv mariadb-5.5.42-linux-x86_64 mysql

8. Change owner group permissions for all files in the mysql folder

# Chown-R root. mysql ./*

9. Copy the configuration file

My-*. cnf in the support file in the mysql file is the configuration file template of mysql. Select an inaccessible template based on the memory size.

Because the mysql library is installed by default during system installation, mysql configuration files are available. We recommend that you create a new folder and put the template in it.

# Mkdir/etc/mysql

# Cp support-files/my-large.cnf/etc/mysql/my. cnf

# Vim/etc/mysql/my. cnf

Add the data file directory to the configuration file.

10. initialize the database

# Cd/usr/local/mysql/scripts

# Scripts/mysql_install_db -- user = mysql -- datadir =/mydata/data

After the mysql database Initialization is complete, you can see that the mysql data file is generated at the specified location. the configuration file of mysql service is searched for multiple different locations in sequence. The parameters of multiple different files are merged and the configuration file found at the End prevails. the configuration file used by mysql is/etc/mysql/my. cnf instead of/etc/my. cnf.

11. Copy the service script

# Cp support-files/mysql. server/etc/rc. d/init. d/mysqld

Add the mysqld service to the service list

# Chkconfig -- add mysqld

12. Start the service

You can see that mysql is successfully started and port 3306 has been listened.

13. Add the mysql script to the PATH

# Vim/etc/profile. d/mysql. sh

After accessing the mysql. sh file, you can use the mysql command to connect to the MariaDB version 5.5.42.

14. Export the header file

# Ln-sv/usr/local/mysql/include // usr/include/mysql

15. Export Database Files

# Vim/etc/ld. so. conf. d/mysql. conf

Write the location of the mysql database file in the file.


Use ldcongfig to regenerate the cache file of the library file search path. You can see the new mysql library file.

Install LAMP (Apache with MariaDB and PHP) in CentOS/RHEL/Scientific Linux 6)

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.