MySQL8.0.18閫氱敤鐗堟湰瀹夎
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL8.0.18閫氱敤鐗堟湰瀹夎相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/mamicode' title='mamicode'>mamicode navicat 鍛戒护 href soc pytho fedora files mic
鐜璇存槑锛?/p>
銆€銆€绯荤粺鐗堟湰锛欳entOS release 6.8 (Final)
銆€銆€mysql鐗堟湰锛歮ysql-8.0.18
銆€銆€鍐呭瓨锛?3G
銆€銆€绌洪棿锛?T
1 閰嶇疆鏈湴yum浠撳簱
2 涓嬭浇瀹夎鍖咃細wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
3 瑙e帇瀹夎鍖咃細tar -zxf mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz -C /usr/local/mysql8
4 鍒涘缓鐢ㄦ埛锛孧ySQL鏁版嵁鐩綍鍜屾巿鏉?/p>
mkdir /data/mysql8
useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql8
chown mysql:mysql /usr/local/mysql8/ -R
chown -R mysql:mysql /data/mysql8/
5 MySQL鍒濆鍖?/p>
cd /usr/local/mysql8/
sudo bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql8 --datadir=/data/mysql8 # 娉ㄦ剰鍒濆鍖栧懡浠ゆ墽琛屽悗浼氱敓鎴愪竴涓复鏃秗oot瀵嗙爜
sudo bin/mysql_ssl_rsa_setup --datadir=/data/mysql8 #鐢熸垚瀵嗛挜瀵?/p>
6 灏哅ySQL鏈嶅姟娣诲姞鍒扮郴缁熸湇鍔′腑
sudo cp support-files/mysql.server /etc/init.d/mysqld -r
vim /etc/init.d/mysqld #淇敼閰嶇疆鏂囦欢涓紝鎸囧畾鏁版嵁鐩綍鍜屽畨瑁呯洰褰?/p>
datadir=/data/mysql8
basedir=/usr/local/mysql8
7 閰嶇疆鐜鍙橀噺锛屼娇鐢ㄥ懡浠?/p>
sudo vim /etc/profile #鏂囦欢鏈熬杩藉姞浠ヤ笅鍐呭
#set MySQL
export PATH=$PATH:/usr/local/mysql8/bin:/usr/local/mysql8/sbin
source /etc/profile
8 鍚姩MySQL鏈嶅姟锛屽厛鍒犻櫎閰嶇疆鏂囦欢
sudo rm -rf /etc/my.cnf
sudo /etc/init.d/mysqld start
#浣跨敤涓存椂瀵嗙爜鐧婚檰鏁版嵁搴?/p>
mysql -uroot -p
鐧婚檰涔嬪悗绔嬪嵆淇敼鏁版嵁搴撶殑瀵嗙爜锛?/p>
mysql>ALTER user 鈥榬oot鈥楡鈥榣ocalhost鈥?nbsp;IDENTIFIED BY 鈥樻柊瀵嗙爜鈥?
鍒锋柊鏉冮檺琛細
mysql>flush privileges;
9 浣跨敤鏂颁慨鏀圭殑root瀵嗙爜鐧诲綍MySQL锛屽苟缁欐柊鐢ㄦ埛鎺堟潈
https://www.cnblogs.com/xxsl/p/10791137.html
mysql -uroot -p鏂板瘑鐮?/p>
mysql>user mysql;
mysql>create user testuser@鈥?鈥?identified by 鈥榯estuser鈥?
mysql>grant all privileges on *.* to 鈥榯estuser鈥楡鈥?鈥?with grant option;
mysql>flush privileges;
10 閰嶇疆MySQL閰嶇疆鏂囦欢 /etc/my.cnf
鍏堝仠姝㈡湇鍔★細
/etc/init.d/mysqld stop
鍦ㄤ慨鏀归厤缃枃浠讹細
vim /etc/my.cnf
[mysqld]
datadir=/data/mysql8
basedir=/usr/local/mysql8
user=mysql
socket=/data/mysql8/mysql.sock
## Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
## instructions in http://fedoraproject.org/wiki/Systemd
#[mysqld_safe]
log-error=/data/mysql8/mysql.log
pid-file=/data/mysql8/mysql.pid
11 閲嶅惎MySQL锛屼娇鐢╮oot杩炴帴
鎶ラ敊鏄剧ず鎵句笉鍒板鎺ュ瓧鏂囦欢锛屽仛涓€涓蒋杩炴帴
ln -s /data/mysql8/mysql.sock /tmp/mysql.sock
鍐嶆鐧婚檰鎴愬姛
mysql -uroot -p鏂板瘑鐮?/p>
鐧婚檰锛屽彲浠ユ垚鍔熸煡鐪?/p>
12 璁剧疆MySQL鏈嶅姟涓哄紑鏈鸿嚜鍚姩
chkconfig mysqld on
chkconfig --list |grep mysqld
13 浣跨敤瀹㈡埛绔痭avicat杩炴帴 鎬绘槸鎶ラ敊1251锛?/p>
涔嬪墠鐨勭増鏈腑鍔犲瘑瑙勫垯鏄痬ysql_native_password,鑰屽湪mysql8涔嬪悗,鍔犲瘑瑙勫垯鏄痗aching_sha2_password,鐩存帴鍘昏繛鎺avicat浼氭姤閿?251
瑙e喅鍔炴硶锛?/p>
鍦?etc/my.cnf涓坊鍔狅細default_authentication_plugin=mysql_native_password
鐒跺悗鍦ㄦ暟鎹簱涓慨鏀箃estuser鐨勮璇佹柟寮忥細
https://blog.csdn.net/u011182575/article/details/80821418
閲嶅惎鏁版嵁搴擄細service mysqld restart
以上是关于MySQL8.0.18閫氱敤鐗堟湰瀹夎的主要内容,如果未能解决你的问题,请参考以下文章