Ubuntu?18.04.4安裝mysql的過程詳解?親測可用
發(fā)布日期:2022-01-30 15:07 | 文章來源:gibhub
下面看下Ubuntu18.04.4安裝mysql的過程,內(nèi)容如下所示:
1 sudo apt-get update
2 sudo apt-get install mysql-server
3 sudo mysql_secure_installation # 初始化配置 #1 VALIDATE PASSWORD PLUGIN can be used to test passwords... Press y|Y for Yes, any other key for No: N (我的選項) #2 Please set the password for root here... New password: (輸入密碼) Re-enter new password: (重復(fù)輸入) #3 By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them... Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (我的選項) #4 Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network... Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (我的選項) #5 By default, MySQL comes with a database named 'test' that anyone can access... Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (我的選項) #6 Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (我的選項) 4 systemctl status mysql.service # 檢查服務(wù)器狀態(tài)
4 systemctl status mysql.service # 檢查服務(wù)器狀態(tài)
running代表無問題
5 修改mysql 端口號以及將監(jiān)聽地址改為所有 vim /etc/mysql/mysql.conf.d/mysqld.cnf # 編輯配置文件 bind-address = 0.0.0.0 #將監(jiān)聽ip修改為所有 port = 3388 # 監(jiān)聽端口修改為3388,可以不改我這是為了安全 修改完畢之后重啟服務(wù) systemctl restart mysql.service
6 開放mysql遠(yuǎn)程訪問 1 登錄數(shù)據(jù)庫 mysql -u root -p 2 切換到數(shù)據(jù)庫mysql use mysql 3 刪除匿名用戶 delete from user where user=''; 4 增加允許遠(yuǎn)程訪問的用戶或者允許現(xiàn)有用戶的遠(yuǎn)程訪問 給root授予在任意主機(jī)(%)訪問任意數(shù)據(jù)庫的所有權(quán)限 mysql> grant all privileges on *.* to 'root'@'%' identified by '這里替換成你想要設(shè)置的密碼' with grant option; flush privileges; 5 退出數(shù)據(jù)庫 mysql> exit 6 重啟數(shù)據(jù)庫 sudo service mysql restart
到此這篇關(guān)于Ubuntu 18.04.4安裝mysql的過程詳解 親測可用的文章就介紹到這了,更多相關(guān)Ubuntu 18.04.4安裝mysql內(nèi)容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章