MySQL 服務(wù)和數(shù)據(jù)庫管理
1、啟動和關(guān)閉服務(wù)指令
1.1windows下Mysql5.7官方MSI安裝地址
(選擇自己心儀的版本安裝):
https://downloads.mysql.com/archives/installer/
1.1.1:win7 會遇到的問題:遇到無法定位程序輸入點fesetround于動態(tài)鏈接庫 解決辦法:
下載C++庫地址:
https://support.microsoft.com/en-us/help/3138367/update-for-visual-c-2013-and-visual-c-redistributable-package
下載選中的安裝完成,繼續(xù)下一步即可:
1.2、windows下
(mysql57為mysql服務(wù)名稱):
- 啟動:
net start mysql57
- 關(guān)閉:
net stop mysql57
1.3、linux下
(mysql 為mysql服務(wù)名稱):
啟動:[root@localhost ~]service mysql start
關(guān)閉:[root@localhost ~]service mysql stop
1.4、windows下cmd窗體進入mysql:
cd到mysql安裝的bin目錄下:
C:\Windows\system32>cd C:\Program Files\MySQL\MySQL Server 5.7\bin
連接mysql服務(wù)器:
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -uroot -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.17-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
mysql
代表客戶端命令, -u
后面跟連接的數(shù)據(jù)庫用戶, -p
表示需要輸入密碼。
1.4、數(shù)據(jù)庫管理
1.4.1、創(chuàng)建一個orderManage數(shù)據(jù)庫
mysql> create database orderManage; Query OK, 1 row affected (0.00 sec)
1.4.2、展示所有的數(shù)據(jù)庫
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | cluster | | mysql | | test | | orderManage| +--------------------+ 5 rows in set (0.00 sec)
可以發(fā)現(xiàn),在上面的列表中除了剛剛創(chuàng)建的orderManage
外,還有另外 4 個數(shù)據(jù)庫,它們都是安裝
MySQL
時系統(tǒng)自動創(chuàng)建的,其各自功能如下。
- 1、
information_schema
:主要存儲了系統(tǒng)中的一些數(shù)據(jù)庫對象信息。比如用戶表信息、列信息、權(quán)限信息、字符集信息、分區(qū)信息等。 - 2、
cluster
:存儲了系統(tǒng)的集群信息。 - 3 、
mysql
:存儲了系統(tǒng)的用戶權(quán)限信息。 - 4、
test
:系統(tǒng)自動創(chuàng)建的測試數(shù)據(jù)庫,任何用戶都可以使用。
1.4.3、選擇進入某一個數(shù)據(jù)
選擇進入orderManage數(shù)據(jù)庫中:
mysql> use ordermanage; Database changed
由此可以發(fā)現(xiàn),選擇進入數(shù)據(jù)庫時候,數(shù)據(jù)庫的名稱是不區(qū)分大小寫的
1.4.4、查看此數(shù)據(jù)庫中的所有表
mysql> show tables; Empty set (0.00 sec)
此時,顯示orderManage
數(shù)據(jù)庫中是沒有表的(Empty set表示操作結(jié)果為空)
1.4.5、刪除數(shù)據(jù)庫
mysql> drop database ordermanage; Query OK, 0 rows affected (0.01 sec)
1.5、配置MySQL允許遠程訪問
通過ip連接出現(xiàn)如下問題:
解決方法:
以root 用戶進入mysql數(shù)據(jù)庫,并查詢登錄用戶信息:
mysql -u root -p use mysql; select host from user where user = 'root'
將host設(shè)置為%
update user set host='%' where user='root';
Host修改完成后記得執(zhí)行flush privileges使配置立即生效即可
flush privileges;
到此這篇關(guān)于MySQL 服務(wù)與數(shù)據(jù)庫管理的文章就介紹到這了,更多相關(guān)MySQL 服務(wù)與數(shù)據(jù)庫管理內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
如何將Excel文件導(dǎo)入MySQL數(shù)據(jù)庫
這篇文章主要為大家詳細介紹了Excel文件導(dǎo)入MySQL數(shù)據(jù)庫的具體方法,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-07-07MySQL中列轉(zhuǎn)行和行轉(zhuǎn)列總結(jié)解決思路
最近工作中用到了好幾次列轉(zhuǎn)行,索性做個小總結(jié),下面這篇文章主要給大家介紹了關(guān)于MYSQL如何列轉(zhuǎn)行的相關(guān)資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2023-01-01通過yum方式安裝mySql數(shù)據(jù)庫的全過程
當工作需要部署mysql時,通過手動上傳安裝包以及依賴包的方式安裝mysql會比較麻煩,可以添加官方y(tǒng)um源,來實現(xiàn)自動安裝依賴,方便快捷,下面這篇文章主要給大家介紹了關(guān)于通過yum方式安裝mySql數(shù)據(jù)庫的相關(guān)資料,需要的朋友可以參考下2022-07-07Advanced Pagination for MySQL(mysql高級分頁)
看到葉金榮的一篇關(guān)于mysql分頁的文章,結(jié)合雅虎之前發(fā)的一篇PDF 談?wù)勛约旱目捶?/div> 2016-08-08最新評論