linux下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、首先可能是電源出現問題導致啓動不起來,建議檢查電源。2、主機內部電路損壞,建議找專業人員維修。3、風扇的轉速以及平穩性不好,導致散熱不好,主機無法啓動。4、CUP損壞後也會出現此現象,CPU損壞無法透過自檢,計算機無法啓動。...
-
改圖片格式方法,如何更改圖片格式
1、找到想要更改格式的圖片。2、找到後,對着圖片右擊,找到“編輯”。3、開啟“編輯”,找到左上角的“檔案(F)”。4、點擊“檔案”,再找到“另存爲(A)...”。5、點擊“另存爲(A)...”,找到“儲存類型(T)”,右邊有一個箭頭。6、點擊箭頭,就會展出許多種圖片格式。7、選擇自己想...
-
手機相冊很多垃圾圖片
我們使用手機去瀏覽網頁,或者是刷微博以及微信的時候,都會加載一些網頁,而且有些圖片還會自動下載儲存到手機相冊裏面,這就是爲什麼我們的手機相冊總是會莫名的多出一些垃圾圖片的原因。如果我們的手機下載了非官網渠道的APP,這種APP軟件會出現無用圖片,會在相冊中保...