MySQL 服务和数据库管理

2022-05-15 0 164
目录
  • 1、启动和关闭服务指令
    • 1.1windows下Mysql5.7官方MSI安装地址
    • 1.2、windows下
    • 1.3、linux下
    • 1.4、windows下cmd窗体进入mysql:
    • 1.4、数据库管理
    • 1.5、配置MySQL允许远程访问

1、启动和关闭服务指令

1.1windows下Mysql5.7官方MSI安装地址

(选择自己心仪的版本安装):

https://downloads.mysql.com/archives/installer/

1.1.1:win7 会遇到的问题:遇到无法定位程序输入点fesetround于动态链接库 解决办法:

下载C++库地址:

https://support.microsoft.com/en-us/help/3138367/update-for-visual-c-2013-and-visual-c-redistributable-package

下载选中的安装完成,继续下一步即可:

MySQL 服务和数据库管理

1.2、windows下

(mysql57为mysql服务名称):

  • 启动:net start mysql57
  • 关闭:net stop mysql57

1.3、linux下

(mysql 为mysql服务名称):

启动:[root@localhost ~]service mysql start

关闭:[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服务器:

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 后面跟连接的数据库用户, -p 表示需要输入密码。

1.4、数据库管理

1.4.1、创建一个orderManage数据库

mysql> create database orderManage;
Query OK, 1 row affected (0.00 sec)

1.4.2、展示所有的数据库

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cluster |
| mysql |
| test |
| orderManage|
+--------------------+ 5 rows in set (0.00 sec)


可以发现,在上面的列表中除了刚刚创建的orderManage外,还有另外 4 个数据库,它们都是安装
MySQL 时系统自动创建的,其各自功能如下。

  • 1、 information_schema:主要存储了系统中的一些数据库对象信息。比如用户表信息、列信息、权限信息、字符集信息、分区信息等。
  • 2、 cluster:存储了系统的集群信息。
  • 3 、mysql:存储了系统的用户权限信息。
  • 4、 test:系统自动创建的测试数据库,任何用户都可以使用。

1.4.3、选择进入某一个数据

选择进入orderManage数据库中:

mysql> use ordermanage;
Database changed


由此可以发现,选择进入数据库时候,数据库的名称是不区分大小写的

1.4.4、查看此数据库中的所有表

mysql> show tables;
Empty set (0.00 sec)


此时,显示orderManage数据库中是没有表的(Empty set表示操作结果为空)

 1.4.5、删除数据库

mysql> drop database ordermanage;
Query OK, 0 rows affected (0.01 sec)


1.5、配置MySQL允许远程访问

通过ip连接出现如下问题:

MySQL 服务和数据库管理

  解决方法:

 以root 用户进入mysql数据库,并查询登录用户信息:

mysql -u root -p

use mysql;

select host from user where user = 'root'

MySQL 服务和数据库管理

将host设置为%

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


Host修改完成后记得执行flush privileges使配置立即生效即可

flush privileges;
 

到此这篇关于MySQL 服务与数据库管理的文章就介绍到这了,更多相关MySQL 服务与数据库管理内容请搜索NICE源码以前的文章或继续浏览下面的相关文章希望大家以后多多支持NICE源码!

免责声明:
1、本网站所有发布的源码、软件和资料均为收集各大资源网站整理而来;仅限用于学习和研究目的,您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。 不得使用于非法商业用途,不得违反国家法律。否则后果自负!

2、本站信息来自网络,版权争议与本站无关。一切关于该资源商业行为与www.niceym.com无关。
如果您喜欢该程序,请支持正版源码、软件,购买注册,得到更好的正版服务。
如有侵犯你版权的,请邮件与我们联系处理(邮箱:skknet@qq.com),本站将立即改正。

NICE源码网 MySql MySQL 服务和数据库管理 https://www.niceym.com/35320.html