CentOS7.2 General-purpose binary format installation mariadb-5.5.46-linux-x86_64.tar.gz documentation and startup failure troubleshooting analysis

Source: Internet
Author: User
Tags documentation

CentOS7.2 Universal binary Format installation mariadb-5.5.46-linux-x86_64.tar.gz

Prepare mariadb-5.5.46-linux-x86_64.tar.gz in advance.

[[email protected] ~]# groupadd-r-G 306 MySQL # # #添加mysql用户

[[email protected] ~]# useradd-r-G 306-u 306 MySQL # # #添加mysql组

[Email protected] dylan]# tar XF mariadb-5.5.46-linux-x86_64.tar.gz-c/usr/local/

[Email protected] dylan]# cd/usr/local/

[Email protected] local]# ln-sv mariadb-5.5.46-linux-x86_64/mysql # # #创建mysql链接

[[Email protected] local]# CD MySQL

[Email protected] mysql]# chown-r root.mysql./* # # #更改属组属组

[Email protected] mysql]# Mkdir-pv/mydata/data # # #创建数据目录

mkdir: The directory "/mydata" has been created

mkdir: The directory "/mydata/data" has been created

[Email protected] mysql]# chown-r mysql.mysql/mydata/data/# # #更改数据目录权限

[Email protected] mysql]# Mkdir/etc/mysql

# # #将选择的配置文件复制至/etc/mysql/, rename to My.cnf

[email protected] mysql]# CP support-files/my-large.cnf/etc/mysql/my.cnf

[Email protected] mysql]# VIM/ETC/MYSQL/MY.CNF # # #编辑添加

Thread_concurrency = 8

DataDir =/mydata/data # # #设定数据文件目录

Innodb_file_per_table = On

Skip_name_resolve = on # # #跳过主机名解析

# # #复制mysqld的服务管理文件至/etc/rc.d/init.d and named Mysqld

[email protected] mysql]# CP support-files/mysql.server/etc/rc.d/init.d/mysqld

[Email protected] mysql]# ls-l/etc/rc.d/init.d/mysqld

-rwxr-xr-x. 1 root root 12196 June 22:28/etc/rc.d/init.d/mysqld

[Email protected] mysql]# chkconfig--add mysqld # # #添加服务

# # #程序初始化, the specified user is MySQL, the data directory is/mydata/data

[Email protected] mysql]# scripts/mysql_install_db--user=mysql--datadir=/mydata/data

[[Email protected] mysql]# service mysqld start

Starting MySQL. error! # # #启动错误

# # #编辑selinux, turn off SELinux

[Email protected] mysql]# Vim/etc/selinux/config

Selinux=disabled

[Email protected] mysql]# Getenforce

Enforcing

[Email protected] mysql]# Setenforce 0

[Email protected] mysql]# Getenforce

Permissive

# # #此时启动依然出错, MySQL read the configuration file not only one, the MySQL process will find a number of locations, and use the final as the final configuration.

[Email protected]/]#/usr/local/mysql/bin/mysql--help--verbose # # #查看读取次序

/usr/local/mysql/bin/mysql Ver 15.1 distrib 5.5.46-mariadb, for Linux (x86_64) using read

Line 5.1Copyright (c), Oracle, MariaDB Corporation Ab and others.

Usage:/usr/local/mysql/bin/mysql [OPTIONS] [Database]

Default options is read from the following files in the given order:

/ETC/MY.CNF/ETC/MYSQL/MY.CNF ~/.MY.CNF # # #读取顺序

# # #于是查看/etc/my.cnf file, in Log-error=/var/log/mariadb/mariadb.log, so see mariadb directory does not exist in/var/log/, need to create manually, or write this off, Otherwise the startup service will fail.

[Email protected] rc.d]# VIM/ETC/MY.CNF

[Mysqld_safe]

Log-error=/var/log/mariadb/mariadb.log# # #错误日志路径

Pid-file=/var/run/mariadb/mariadb.pid

# # # #查看/var/log/and there is no mariadb directory, so there are three ways to solve:

1.mv/etc/my.cnf/etc/my.cnf.bak# # #使/ETC/MY.CNF failure

2.vim/etc/my.cnf

#log-error=/var/log/mariadb/mariadb.log# # #注销掉

3.MKDIR/VAR/LOG/MARIADB # # #创建mariadb目录

[Email protected] mysql]# mkdir/var/log/mariadb # # #此处使用第三种方法

[[Email protected] mysql]# service mysqld start

Starting MySQL ... success! # # #成功启动

# # #修改环境变量

[Email protected] rc.d]# vim/etc/profile.d/mysql.sh

Export Path=/usr/local/mysql/bin: $PATH

[Email protected] rc.d]# source/etc/profile.d/mysql.sh # # #重读此配置文件

# # #导出头文件

[Email protected] rc.d]# ln-sv/usr/local/mysql/include//usr/include/mysqld

"/usr/include/mysqld", "/usr/local/mysql/include/"

# # #导出库文件

[Email protected] ld.so.conf.d]# vim/etc/ld.so.conf.d/mysql.conf

/usr/local/mysql/lib

[Email protected] ld.so.conf.d]# ldconfig# # #系统重载入系统库

[[email protected] ld.so.conf.d]# ldconfig-p |grep mysql# # #查看库文件读取

libmysqld.so.18 (libc6,x86-64) =/usr/local/mysql/lib/libmysqld.so.18

Libmysqld.so (libc6,x86-64) =/usr/local/mysql/lib/libmysqld.so

libmysqlclient.so.18 (libc6,x86-64) =/usr/lib64/mysql/libmysqlclient.so.18

libmysqlclient.so.18 (libc6,x86-64) =/usr/local/mysql/lib/libmysqlclient.so.18

Libmysqlclient.so (libc6,x86-64) =/usr/local/mysql/lib/libmysqlclient.so

# # #mysql安全加固

[Email protected] bin]# mysql_secure_installation # # #运行此命令进行设置


This article is from the "11290766" blog, please be sure to keep this source http://rylan.blog.51cto.com/11290766/1940437

CentOS7.2 General-purpose binary format installation mariadb-5.5.46-linux-x86_64.tar.gz documentation and startup failure troubleshooting analysis

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.