溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

MySQL 服務(wù)與數(shù)據(jù)庫管理的方法是什么

發(fā)布時間:2021-11-09 13:33:58 來源:億速云 閱讀:157 作者:iii 欄目:開發(fā)技術(shù)

本篇內(nèi)容主要講解“MySQL 服務(wù)與數(shù)據(jù)庫管理的方法是什么”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學(xué)習(xí)“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ù)下一步即可

MySQL 服務(wù)與數(shù)據(jù)庫管理的方法是什么

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窗體進(jìn)入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、選擇進(jìn)入某一個數(shù)據(jù)

選擇進(jìn)入orderManage數(shù)據(jù)庫中:

mysql> use ordermanage;
Database changed

由此可以發(fā)現(xiàn),選擇進(jì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允許遠(yuǎn)程訪問
通過ip連接出現(xiàn)如下問題:

MySQL 服務(wù)與數(shù)據(jù)庫管理的方法是什么

  解決方法:

 以root 用戶進(jìn)入mysql數(shù)據(jù)庫,并查詢登錄用戶信息:

mysql -u root -p

use mysql;

select host from user where user = 'root'

MySQL 服務(wù)與數(shù)據(jù)庫管理的方法是什么

將host設(shè)置為%

update user set host='%' where user='root';

Host修改完成后記得執(zhí)行flush privileges使配置立即生效即可

flush privileges;

到此,相信大家對“MySQL 服務(wù)與數(shù)據(jù)庫管理的方法是什么”有了更深的了解,不妨來實際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI