centos7 mysql 8.0.13安裝完整版
阿新 • • 發佈:2018-12-07
第一步下載
https://dev.mysql.com/downloads/mysql/
第二步上傳到伺服器
tar -zxvf mysql-8.0.13-el7-x86_64.tar.gz
cd mysql-8.0.13-el7-x86_64
mv mysql-8.0.13-el7-x86_64 mysql8.0.13_x64
第三步 建立 mysql 使用者組和 mysql 使用者
groupadd mysql
useradd -g mysql mysql
第四步 改變 mysql 目錄許可權
chown -R mysql.mysql /usr/local/ mysql8.0.13_x64/
第五步 mysql配置
[mysql] default-character-set=utf8mb4 socket=/var/lib/mysql/mysql.sock [client] default-character-set=utf8mb4 socket=/var/lib/mysql/mysql.sock [mysqld] user=mysql skip-name-resolve server-id=1 port=3306 lower_case_table_names=1 socket=/var/lib/mysql/mysql.sock basedir=/usr/local/mysql-8.0.13_x64 datadir=/usr/local/mysql-8.0.13_x64/data max_connections=800 character-set-server=utf8mb4 default-storage-engine=INNODB max_allowed_packet=16M innodb_buffer_pool_size=1G innodb_flush_log_at_trx_commit=2 binlog_format=MIXED log-bin=/usr/local/mysql-8.0.13_x64/logs/binlog/mysql-log binlog-ignore-db=mysql default_authentication_plugin=mysql_native_password sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
第六步 執行 ./mysqld –initialize-insecure 預設空密碼
出現以下錯誤
需要安裝 libnuma
yum install libnuma
yum -y install numactl
yum install libaio1 libaio-dev
./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
第七步建立MySQL服務
cp -a ./support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/rc.d/init.d/mysqld chkconfig --add mysqld
可以檢查一下服務是否生效
chkconfig --list
第八步 配置全域性環境
vi /etc/profileexport MYSQL_HOME=/usr/local/mysql-8.0.13_x64
PATH=$MYSQL_HOME/bin:$PATH
export PATH
儲存退出,使環境變數生效
source /etc/profile
第九步 啟動mysql服務,關閉和重啟
service mysqld startservice mysqld stop service mysqld restart
第十步
修改密碼
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密碼';
mysql>update user set host='%' where user='root' limit 1;
// 重新整理許可權
mysql>flush privileges;
然後檢查3306埠是否開放
netstat -nupl|grep 3306
開放3306埠
firewall -cmd --permanent --add-prot=3306/tcp
重啟防火牆
firewall -cmd --reload
錯誤一
把share/english下面的errmsg.sys複製到share目錄下面