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)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信