运维开发网

mysql8.0安装

运维开发网 https://www.qedev.com 2021-02-26 13:05 出处:51CTO 作者:小小三郎1
1.说明  mariadb升级为 mysql8.0.112.47数据库备份  bash -x /root/backupdb/mysql_4.sh3.47环境停止mariadb  systemctl stop mariadb4.备份my.cnf cp /etc/my.cnf    /etc/my.conf.15.开始安装Mysql8.0①解压数据库mv操作mkdir  -p  /usr/local/

1.说明

  mariadb升级为 mysql8.0.11

2.47数据库备份

  bash -x /root/backupdb/mysql_4.sh

3.47环境停止mariadb

  systemctl stop mariadb

4.备份my.cnf

 cp /etc/my.cnf    /etc/my.conf.1

5.开始安装Mysql8.0

①解压数据库mv操作

mkdir  -p  /usr/local/mysql

mv mysql-8.0.11-Linux-glibc2.12-x86_64  /usr/local/mysql/mysql8.0

②创建目录

mkdir  -p  /usr/local/mysql/mysql8.0/socket

mkdir  -p  /usr/local/mysql/mysql8.0/pid

mkdir  -p  /usr/local/mysql/mysql8.0/data

mkdir  -p  /usr/local/mysql/mysql8.0/log

chown -R   mysql.mysql /usr/local/mysql/mysql8.0

③配置文件

vi /etc/my.cnf 

[client]

port=3306

socket=/usr/local/mysql/mysql8.0/socket/mysql.sock

default-character-set=utf8

[mysqld]

server-id=1

port=3306

user=mysql

max_connections=1000

socket=/usr/local/mysql/mysql8.0/socket/mysql.sock

basedir=/usr/local/mysql/mysql8.0

datadir=/usr/local/mysql/mysql8.0/data

pid-file=/usr/local/mysql/mysql8.0/pid/mysql.pid

init-connect='SET NAMES utf8'

character-set-server=utf8

default-storage-engine=INNODB

log_error=/usr/local/mysql/mysql8.0/log/error.log

innodb_buffer_pool_size=10G

slow_query_log = ON

slow_query_log_file=/usr/local/mysql/mysql8.0/log/slowlog.log

long_query_time = 1

default_authentication_plugin=mysql_native_password

④编译安装

cd /usr/local/mysql/mysql8.0

./bin/mysqld --user=mysql --basedir=/usr/local/mysql/mysql8.0/ --datadir=/usr/local/mysql/mysql8.0/data/ --initialize

⑤配置启动

cp -a ./support-files/mysql.server /etc/init.d/mysql

chmod +x   /etc/init.d/mysql

⑥修改密码

skip-grant-tables = 1  ###添加入配置文件 然后重启

flush privileges

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

use mysql;

update user  set   host='%'  where user='root'  and host='localhost';

flush  privileges;

skip-grant-tables = 1  ###删除配置 然后重启

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号