如何在Ubuntu 18.04系統(tǒng)中安裝MySQL5.7?相信很多沒(méi)有經(jīng)驗(yàn)的人對(duì)此束手無(wú)策,為此本文總結(jié)了問(wèn)題出現(xiàn)的原因和解決方法,通過(guò)這篇文章希望你能解決這個(gè)問(wèn)題。
成都創(chuàng)新互聯(lián)主營(yíng)蔡家坡網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,成都app軟件開(kāi)發(fā),蔡家坡h5微信小程序定制開(kāi)發(fā)搭建,蔡家坡網(wǎng)站營(yíng)銷(xiāo)推廣歡迎蔡家坡等地區(qū)企業(yè)咨詢(xún)
具體內(nèi)容如下
1.1安裝
首先執(zhí)行下面三條命令:
# 安裝mysql服務(wù) sudo apt-get install mysql-server # 安裝客戶(hù)端 sudo apt install mysql-client # 安裝依賴(lài) sudo apt install libmysqlclient-dev # 檢查狀態(tài) sudo netstat -tap | grep mysql
1.2設(shè)置root密碼
mysql5.7安裝完成后普通用戶(hù)不能進(jìn)mysql,原因:root的plugin被修改成了auth_socket,用密碼登陸的plugin應(yīng)該是mysql_native_password,直接用root權(quán)限登錄就不用密碼,修改root密碼和登錄驗(yàn)證方式:
$ sudo su # mysql mysql> mysql> select user, plugin from mysql.user; +------------------+-----------------------+ | user | plugin | +------------------+-----------------------+ | root | auth_socket | | mysql.session | mysql_native_password | | mysql.sys | mysql_native_password | | debian-sys-maint | mysql_native_password | +------------------+-----------------------+ 4 rows in set (0.00 sec) mysql> update mysql.user set authentication_string=PASSWORD('123456'), plugin='mysql_native_password' where user='root'; mysql> flush privileges; mysql> exit Bye # exit $ sudo /etc/init.d/mysql restart $ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.22-0ubuntu18.04.1 (Ubuntu) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
1.3配置mysql遠(yuǎn)程登錄
# 修改配置文件,注釋掉bind-address = 127.0.0.1 $ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf # 保存退出,然后進(jìn)入mysql服務(wù),執(zhí)行授權(quán)命令: $ mysql -uroot -p mysql> grant all on *.* to root@'%' identified by '123456' with grant option; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye $ sudo /etc/init.d/mysql restart
看完上述內(nèi)容,你們掌握如何在Ubuntu 18.04系統(tǒng)中安裝mysql5.7的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!
本文標(biāo)題:如何在Ubuntu18.04系統(tǒng)中安裝mysql5.7
網(wǎng)站URL:http://www.rwnh.cn/article20/pcojco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化、全網(wǎng)營(yíng)銷(xiāo)推廣、建站公司、用戶(hù)體驗(yàn)、ChatGPT、網(wǎng)站收錄
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)