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>

鎶€鏈浘鐗? src=

涔嬪墠鐨勭増鏈腑鍔犲瘑瑙勫垯鏄痬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閫氱敤鐗堟湰瀹夎的主要内容,如果未能解决你的问题,请参考以下文章

鎵嬫妸鎵嬫暀浣犲湪Windows鐜涓嬪崌绾

Mosquitto鍦╓INDOWS瀹夎

JDBC閫氱敤鐨勬暟鎹簱鏁版嵁鎿嶄綔[CRUD]灏佽

koa,express,node閫氱敤鏂规硶杩炴帴MongoDB

KaliLinux鍒囨崲python鐗堟湰

svn鐗堟湰鎺у埗