CentOS 7 MARIADB Installation configuration steps detailed

Source: Internet
Author: User
Tags mkdir mysql client socket centos

System Environment: CentOS 7
MARIADB version: Mariadb 10.0.14
Download Address: http://mirrors.neusoft.edu.cn/mariadb/mariadb-10.0.14/source/mariadb-10.0.14.tar.gz
Other Package Address: https://downloads.mariadb.org/

Add a MySQL User

Useradd MySQL

Start Compiling installation mariadb

wget http://mirrors.neusoft.edu.cn/mariadb/cmariadb-10.0.14/source/mariadb-10.0.14.tar.gz
Tar zxvf mariadb-10.0.14.tar.gz
CD mariadb-10.0.14
CMake.
Make
Make install

Chown-r mysql/usr/local/mysql/
scripts/mysql_install_db--user=mysql
/usr/local/mysql/bin/mysqld_safe--user=mysql &

Start if error, it should be mariadb startup to create some log files by default, or run related files, but did not create, or the specified directory does not exist
This is usually because:
I. Creating Mariadb.log files in/var/log/mariadb/does not have permissions
Two. There is no permission to create Mariadb.pid in/VAR/RUN/MARIADB.

So we're going to create two separate directories.


Mkdir/var/log/mariadb
Mkdir/var/run/mariadb

Chown mysql-r/var/run/mariadb #所有权给mysql用户, you cannot create/var/run/mariadb/mariadb.pid files
Of course, the above configuration can be modified, MY.CNF configuration file to modify its location

To modify the root user password:


/usr/local/mysql/bin/mysqladmin-u root password ' 123456 '

Other problems that may be encountered
1. mysql client cannot start

Modify/ETC/MY.CNF


[MySQL]
Socket=/var/lib/mysql/mysql.sock

2. ERROR 2002 (HY000): Can ' t connect to the local MySQL server through socket '/tmp/mysql.sock ' (2)
This error is due to the socket position, add a soft chain, of course, modify the/etc/my.cnf sock location can also


Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock

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: info-contact@alibabacloud.com 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.