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


启动报错:

[root@mydb1 mysql3308]# service mysqld3308 start
Starting MySQL SUCCESS! 
[root@mydb1 mysql3308]# 170605 15:26:25 mysqld_safe A mysqld process already exists

[root@mydb1 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

然后重启搞定。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值