MySQL 5.7.18 在centos下安装记录
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL 5.7.18 在centos下安装记录相关的知识,希望对你有一定的参考价值。
一个朋友找我如何在Linux下安装mysql5.7.18,我稍微整理下了下记录,如下:
下载地址:
MySQL5.7.18参数官方网址:https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_user_connections,下载完后的包是MySQL-5.7.18-linux-glibc2.5-x86_64.tar.gz
上面的网址如果找不到,就来百度云盘下载:链接: https://pan.baidu.com/s/1bECiEM 密码: c2my
安装脚本myql_install_5.7.18.sh,可以执行脚本,实现这个一键式安装好mysql5.7.18:
#!/bin/bash
# install the basie lib
useradd mysql
yum install cmake -y
yum install -y libtoolize
yum install gcc gcc-c++ -y
yum install -y ncurses-devel.x86_64
yum install -y cmake.x86_64
yum install -y libaio.x86_64
yum install -y bison.x86_64
yum install -y gcc-c++.x86_64
# unzip
rm -rf /usr/local/mysql-5.7.18*
tar -xvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local
mv /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql3308
cp my.cnf /tmp/
cp /tmp/my.cnf /usr/local/mysql3308/my.cnf
# add mysql account,create the basic directory
rm -rf /home/data/mysql3308/data
mkdir -p /home/data/mysql3308/data
cd /home/data/mysql3308/data
chown -R mysql:mysql /usr/local/mysql3308
mkdir -p /home/data/mysql3308/binlog/
chown -R mysql:mysql /home/data/mysql3308/binlog/
# init databases
rm -rf /home/data/mysql3308/data/*
cd /usr/local/mysql3308/
time /usr/local/mysql3308/bin/mysqld --defaults-file=/usr/local/mysql3308/my.cnf --initialize-insecure --user=mysql
# “MySQL Enterprise Audit Security Considerations”
#mkdir -p /home/data/mysql/data/ssl/
chown -R mysql:mysql /home/data/mysql/data/ssl
cd /usr/local/mysql3308/
time bin/mysql_ssl_rsa_setup --datadir=/home/data/mysql/data/ssl/
# set the auto start on linux server started
rm -rf /etc/init.d/mysqld3308*
cp support-files/mysql.server /etc/init.d/mysqld3308
chmod 700 /etc/init.d/mysqld3308
echo "export PATH=$PATH:/usr/local/mysql3308/bin">>/etc/profile
chkconfig --add mysqld3308
source /etc/profile
vim /etc/init.d/mysqld3308
basedir=/usr/local/mysql3308
datadir=/home/data/mysql3308/data
# start the mysql server
echo "" > /usr/local/mysql3308/mysqld.log
chown -R mysql:mysql /usr/local/mysql3308/mysqld.log
service mysqld3308 start
启动报错:
[[email protected] mysql3308]# service mysqld3308 start
Starting MySQL SUCCESS!
[[email protected] mysql3308]# 170605 15:26:25 mysqld_safe A mysqld process already exists
[[email protected] mysql3308]#
后台error日志里面的启动报错信息:
2017-06-05T09:09:32.291104Z 0 [Note] Plugin ‘FEDERATED‘ is disabled.
2017-06-05T09:09:32.292966Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170605 17:09:32
2017-06-05T09:09:32.304707Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-06-05T09:09:32.304749Z 0 [Note] Server hostname (bind-address): ‘*‘; port: 3306
2017-06-05T09:09:32.304902Z 0 [Note] IPv6 is available.
2017-06-05T09:09:32.304930Z 0 [Note] - ‘::‘ resolves to ‘::‘;
2017-06-05T09:09:32.304964Z 0 [Note] Server socket created on IP: ‘::‘.
2017-06-05T09:09:32.305012Z 0 [ERROR] Can‘t start server: Bind on TCP/IP port: Address already in use
2017-06-05T09:09:32.305023Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2017-06-05T09:09:32.305041Z 0 [ERROR] Aborting
2017-06-05T09:09:32.305060Z 0 [Note] Binlog end
解决方法,以下2个操作即可
vim /etc/init.d/mysqld3308
(1)将basedir和datadir变成下面
basedir=/usr/local/mysql3308
datadir=/home/data/mysql3308/data
(2)
把所有的/usr/local/mysql变成/usr/local/mysql3308
然后重启搞定。
以上是关于MySQL 5.7.18 在centos下安装记录的主要内容,如果未能解决你的问题,请参考以下文章
cenos下安装MySQL最新版(5.7.18)记录。附卸载老版本过程