天天看點

centos mysql config_centos7解壓安裝mysql8.0.22

yum install epel-release -y

yum install gcc -y

yum install libgcc gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers glibc-util glibc-static libcurl libcurl-devel libconfig libconfig-devel -y

yum install ncurses-devel ncurses -y

yum install zip unzip -y

yum install lrzsz -y

yum install pcre pcre-devel pcre-static zlib zlib-devel zlib-static openssl openssl-devel openssl-static -y

yum install libaio libaio-devel libgcc libgcc-devel libstdc++ libstdc++-devel -y

yum install curl wget iputils nmap-ncat bind-utils openssh-clients lftp -y

yum install libffi-devel -y

yum install tcl tclx tcl-devel -y

yum install expect -y

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.22-linux-glibc2.12-x86_64.tar.xz

xz -d mysql-8.0.22-linux-glibc2.12-x86_64.tar.xz

tar -xvf mysql-8.0.22-linux-glibc2.12-x86_64.tar

groupadd mysql

useradd -g mysql mysql

passwd mysql

cp -a mysql-8.0.22-linux-glibc2.12-x86_64 /home/mysql/mysql8.0.22

cd /home/mysql/

ln -s mysql8.0.22 mysql8

cd mysql-8.0.22-linux-glibc2.12-x86_64

mkdir data

chown -R mysql:mysql mysql8

chown -R mysql:mysql mysql8.0.22

#./mysqld --user=mysql --basedir=/home/mysql/mysql8 --datadir=/home/mysql/mysql8/data/ --initialize --console

./mysqld --user=mysql --basedir=/home/mysql/mysql8 --datadir=/home/mysql/mysql8/data/ --initialize

vim /etc/my.cnf

添加修改

[mysqld]

basedir=/home/mysql/mysql8/

datadir=/home/mysql/mysql8/data/

socket=/tmp/mysql.sock

#socket=/var/lib/mysql/mysql.sock

character-set-server=utf8mb4

注釋

[mysqld_safe]

#log-error=/var/log/mariadb/mariadb.log

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

有這個,請知曉,什麼都不改

vim /etc/my.cnf.d/mysql-clients.cnf

mkdir /var/lib/mysql

chown -R mysql:mysql /var/lib/mysql/

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

chmod +x /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig --list mysqld

service mysqld status

service mysqld start

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

flush privileges;

檢視編碼

show variables like '%char%';

後記:

設定允許遠端登入

use mysql;

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

#update user set user.Host='%' where user.User='root';

flush privileges;

#./mysqld --user=mysql --basedir=/home/mysql/mysql8 --datadir=/home/mysql/mysql8/data/ --initialize --console

./mysqld --user=mysql --basedir=/home/mysql/mysql8 --datadir=/home/mysql/mysql8/data/ --initialize

2021-02-03T09:20:20.739066Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.

2021-02-03T09:20:20.739171Z 0 [System] [MY-013169] [Server] /home/mysql/mysql8.0.22/bin/mysqld (mysqld 8.0.22) initializing of server in progress as process 28278

2021-02-03T09:20:20.749609Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2021-02-03T09:20:21.221188Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2021-02-03T09:20:22.307392Z 6 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: Psdfegsdf8di

./mysqld --user=mysql --basedir=/home/mysql/mysql8 --datadir=/home/mysql/mysql8/data/ --initialize

2021-02-08T01:45:31.812545Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.

2021-02-08T01:45:31.812644Z 0 [System] [MY-013169] [Server] /home/mysql/mysql8.0.22/bin/mysqld (mysqld 8.0.22) initializing of server in progress as process 27000

2021-02-08T01:45:31.819333Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2021-02-08T01:45:32.260915Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2021-02-08T01:45:33.259762Z 6 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: Psfdssasfe5gI

其它配置檔案/etc/my.cnf

[mysqld]

# 設定3306端口

port=3306

# 設定mysql的安裝目錄

basedir=/usr/local/mysql

# 設定mysql資料庫的資料的存放目錄

datadir=/usr/local/mysql/mysqldb

# 允許最大連接配接數

max_connections=10000

# 允許連接配接失敗的次數。這是為了防止有人從該主機試圖攻擊資料庫系統

max_connect_errors=10

# 服務端使用的字元集預設為UTF8

character-set-server=utf8

# 建立新表時将使用的預設存儲引擎

default-storage-engine=INNODB

# 預設使用“mysql_native_password”插件認證

default_authentication_plugin=mysql_native_password

[mysql]

# 設定mysql用戶端預設字元集

default-character-set=utf8

[client]

# 設定mysql用戶端連接配接服務端時預設使用的端口

port=3306

default-character-set=utf8