centos7 安装mysql8 绿色版
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 安装mysql8 绿色版相关的知识,希望对你有一定的参考价值。
wget -c https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz
xz -d mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz
tar xvf mysql-8.0.16-linux-glibc2.12-x86_64.tar
mv mysql-8.0.16-linux-glibc2.12-x86_64 /usr/local/mysql8
cd /usr/local/mysql8
mkdir data
rm /etc/my.cnf
mkdir etc
groupadd mysql
useradd -r -g mysql mysql
chown -R mysql:mysql /usr/local/mysql8
cp /usr/local/mysql8/support-files/mysql.server /etc/init.d/mysql.server
vi /etc/init.d/mysql.server
basedir=/usr/local/mysql8
datadir=/usr/local/mysql8/data
vi /usr/local/mysql8/etc/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
user = mysql
server-id = 1
port = 3306
basedir = /usr/local/mysql8
datadir = /usr/local/mysql8/data
pid-file = /usr/local/mysql8/log/mysql.pid
tmpdir = /tmp
socket = /tmp/mysql.sock
max_connections = 400
max_connect_errors = 1000
max_allowed_packet = 128M
interactive_timeout = 1800
wait_timeout = 1800
tmp_table_size = 134217728
max_heap_table_size = 134217728
log_error = /usr/local/mysql8/log/error.log
slow_query_log = 1
slow_query_log_file = /usr/local/mysql8/log/slow.log
log_queries_not_using_indexes = 1
log_throttle_queries_not_using_indexes = 5
log_slow_slave_statements = 1
long_query_time = 8
min_examined_row_limit = 100
expire_logs_days = 5
/usr/local/mysql8/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql8 --datadir=//usr/local/mysql8/data
(保存临时密码)
mv /usr/local/mysql8/etc/my.cnf /etc/
touch /usr/local/mysql8/log/error.log
touch /usr/local/mysql8/log/slow.log
touch /usr/local/mysql8/log/mysql.pid
chown -R mysql:mysql /usr/local/mysql8/log/error.log /usr/local/mysql8/log/slow.log /usr/local/mysql8/log/mysql.pid
service mysql.server start
#登录
mysql -uroot -p
#重启设置密码
ALTER USER ‘root‘@‘localhost‘ identified by ‘123456‘;
flush privileges;
以上是关于centos7 安装mysql8 绿色版的主要内容,如果未能解决你的问题,请参考以下文章
Linux(CentOS7)安装与卸载MySQL8.0图文详解