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遠程訪問 1 登錄數(shù)據(jù)庫 mysql -u root -p 2 切換到數(shù)據(jù)庫mysql use mysql 3 刪除匿名用戶 delete from user where user=''; 4 增加允許遠程訪問的用戶或者允許現(xià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)文章
Windows server 2008 r2下MySQL5.7.17 winx64安裝版配置方法圖文教程
這篇文章主要為大家詳細介紹了Windows server 2008 r2下MySQL5.7.17 winx64安裝版配置方法圖文教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-03-03window環(huán)境配置Mysql 5.7.21 windowx64.zip免安裝版教程詳解
這篇文章主要介紹了window環(huán)境配置Mysql 5.7.21 windowx64.zip免安裝版教程詳解,需要的朋友可以參考下2018-02-02MySQL的日志基礎(chǔ)知識及基本操作學(xué)習(xí)教程
這篇文章主要介紹了MySQL的日志基礎(chǔ)知識學(xué)習(xí)教程,包括MySQL中日志相關(guān)常用的服務(wù)器變量說明,極力推薦!需要的朋友可以參考下2015-11-11解決MySQL Sending data導(dǎo)致查詢很慢問題的方法與思路
這篇文章主要介紹了解決MySQL Sending data導(dǎo)致查詢很慢問題的方法與思路,感興趣的小伙伴們可以參考一下2016-04-04mysql中insert與select的嵌套使用解決組合字段插入問題
本節(jié)主要介紹了mysql中insert與select的嵌套使用解決組合字段插入問題,需要的朋友可以參考下2014-07-07