mysql怎麼安裝
產品型號:Thinkpad E15
系統版本:centos7
軟件版本:mysql 5.7
mysql安裝教程
1.使用yum安裝mysql數據庫的軟件包
[root@xuegod63 ~]# yum -y install mariadb-server mariadb
注:
mariadb-server #MariaDB數據庫
mariadb # MariaDB服務器Linux下客戶端
注:從centos7系統開始,系統中自帶的mysql數據庫變成了mariadb-server,mariadb-server和mysql操作上一樣。mariadb-server是mysql的一個分支。
2.啓動數據庫服務
[root@xuegod63 ~]# systemctl start mariadb #啓動MariaDB服務
[root@xuegod63 ~]# systemctl enable mariadb #設置開啓自動啓動MariaDB服務
3. 安裝完mariadb-server後,運行mysql_secure_installation去除安全隱患
[root@xuegod63 ~]# mysql_secure_installation#進入安全配置導向
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): #初次運行直接回車,因爲root用戶沒有密碼
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] Y#是否設置root用戶密碼,輸入Y
New password: 123456 #新密碼123456
Re-enter new password: 123456
Password updated successfully!
。。。
Remove anonymous users? [Y/n] Y #是否刪除匿名用戶,生產環境建議刪除,所以直接回車或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.
Disallow root login remotely? [Y/n] Y #是否禁止root遠程登錄,根據自己的需求選擇Y/n並回車,建議禁止
... Success!
By default, MariaDB 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.
Remove test database and access to it? [Y/n] Y #是否刪除test數據庫,直接回車或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.
Reload privilege tables now? [Y/n] Y #是否重新加載權限表,直接回車
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
… Success!
至此數據庫安裝成功。
4. 登錄數據庫
[root@xuegod63 ~]# mysql -u root -p123456
MariaDB [(none)]> show databases; #沒有test數據庫 #執行時,所有命令以;號結尾
+-------------------------+
| Database|
+-------------------------+
| information_schema|
| mysql|
| ucenter |
+-------------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> exit #退出命令可以加分號,也可以不加分號。
總結:
1、使用yum安裝mysql數據庫的軟件包
2、啓動數據庫服務
3、運行mysql_secure_installation去除安全隱患
4、登錄數據庫
-
新筆記本電腦第一次充電要多久,筆記本電腦充電時間
1、第一次先把筆記本電池中的電完全用完,然後關機充電12個小時以上,最好14個小時左右。2、只有第一次充電需要衝的時間長,以後每次都是充滿即可,現在的筆記本都是有完善的電源管理電路和充電管理體系,充電時間過長,這樣會導致充電時熱量過高,會引起爆炸等現象。3、如...
-
吃菠蘿什麼好處
菠蘿是一種熱帶水果,從十六世紀末傳入中國以來,因爲吃起來酸甜可口,成爲備受人們喜愛的熱帶水果之一,也因此在中國南方,氣候適宜的地方得到普遍的栽培,中國也是世界十大菠蘿產國之一。在生活中有人可能分不清菠蘿和鳳梨的區別,從生物學上來說,這倆是同一種水果,但是在商...
-
樂視視頻開通會員怎麼開
開通樂視視頻會員的途徑很簡單,在官網註冊賬號選擇開通的會員類型,點擊支付即可。也可以通過手機裏面的樂視視頻APP開通會員,先註冊或者登錄已有賬號,選擇右下角的未登錄,點進去可以選擇開通會員。首先,打開樂視視頻軟件,進入主頁面後,選擇右下角的“未登錄”,再“點擊...
-
微博如何移動好友分組
1、進入個人微博,點擊主頁裏的“關注”。或者從首頁裏邊的“關注”進入也是可以的。2、進入關注列表後自動顯示爲查看其他分組,這個時候你可以看到“批量管理”和“排序”兩個選項,你可以進行初步排序管理。3、單擊“查看其他分組”,裏面有你微博裏所有的分組,我們...