您好,登錄后才能下訂單哦!
AWS中怎么安裝Mysql,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
第一步: 切換到root賬戶
sudo -s
更換時區為東八區(北京時間)
mv /etc/localtime /etc/localtime.bak cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
第二步: 需要更新一下yum(因為亞馬遜的yum版本經常都是晚于潮流)
yum update
第三步: 安裝mysql
yum install -y mysql57-server
如果提示 Unable to find a match: mysql57-server則需要去mysql官網獲取下安裝包
//下載 sudo rpm -ivh https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm //安裝 sudo yum install mysql-server
第四步: 啟動mysql
service mysqld start #設置開機自啟動 chkconfig mysqld on
第五步: 做一些基礎配置
mysql_secure_installation
下面的內容會比較多,其實就幾個
[root@ip-172-31-35-183 ec2-user]# mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? #詢問你是否啟用密碼校驗 Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file #詢問你要使用什么強度的密碼,輸入0就可以使用任意密碼,還有 1和2可選自己看上兩行的強度要求 Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 Please set the password for root here. #輸入你的密碼 New password: #再次數據你的密碼 Re-enter new password: #這行是評價你設定密碼的強度,可以忽略 Estimated strength of the password: 50 #上一行評價了你的密碼強度,如果你覺得不夠,你可以輸入n重新設置密碼,如果對自己的密碼滿意就輸入y,確認使用新密碼 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y 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. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. #詢問你是否刪除所有匿名用戶,直接選y即可,不需要多想(要多想也隨意) Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. #問你是否要禁用root賬戶的遠程連接,如果禁用了你就只能玩單機操作了,所以選擇 n Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. #問你要不要刪除所有測試數據,數據庫新裝會有一些默認的測試數據,刪不刪沒影響,y和n隨意 Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. #問你要不要更新配置(屁話,設置這么辛苦肯定馬上更新使用了) y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
第六步: 使用剛設置的密碼登入數據庫,修改遠程ip權限
mysql -u root -p
設置用戶 root 可以在任意 IP 下被訪問:
grant all privileges on *.* to root@"%" identified by "你的密碼";
設置用戶 root 可以在本地被訪問:
grant all privileges on *.* to root@"localhost" identified by "你的密碼";
設置完訪問權限后,需要刷新一下
flush privileges
至此結束
關于AWS中怎么安裝Mysql問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。