Ubuntu?18.04.4安裝mysql的過程詳解?親測可用
下面看下Ubuntu 18.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授予在任意主機(%)訪問任意數(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)文章希望大家以后多多支持腳本之家!
相關(guān)文章
MySQL數(shù)據(jù)庫Shell import_table數(shù)據(jù)導(dǎo)入
本文我們介紹一款高效的數(shù)據(jù)導(dǎo)入工具,MySQL Shell 工具集中的import_table,該工具的全稱是Parallel Table Import Utility,需要的朋友請參考下文2021-08-08
避坑:Sql中?in?和not?in中有null值的情況說明
這篇文章主要介紹了避坑:Sql中?in?和not?in中有null值的情況說明,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-07-07
Django+mysql配置與簡單操作數(shù)據(jù)庫實例代碼
這篇文章主要介紹了Django+mysql配置與簡單操作數(shù)據(jù)庫實例,需要的朋友可以參考下2017-07-07
最新MySql8.27主從復(fù)制及SpringBoot項目中的讀寫分離實戰(zhàn)教程
MySQL主從復(fù)制是一個異步的復(fù)制過程,底層是基于MySQL1數(shù)據(jù)庫自帶的二進(jìn)制日志功能,這篇文章主要介紹了最新MySql8.27主從復(fù)制及SpringBoot項目中的讀寫分離實戰(zhàn)教程,需要的朋友可以參考下2022-08-08
mysql 5.7.13 winx64安裝配置方法圖文教程(win10)
這篇文章主要為大家分享了mysql 5.7.13 winx64安裝配置方法圖文教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-01-01
MySQL 中查詢 VARCHAR 類型 JSON 數(shù)據(jù)的問題記錄
在數(shù)據(jù)庫設(shè)計中,有時我們會將 JSON 數(shù)據(jù)存儲在 VARCHAR 或 TEXT 類型字段中,本文將詳細(xì)介紹如何在 MySQL 中有效查詢存儲為 VARCHAR 類型的 JSON 數(shù)據(jù),感興趣的朋友一起看看吧2025-04-04

