欢迎投稿

今日深度:

MySQL 服务和数据库管理,

MySQL 服务和数据库管理,


目录
  • 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

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

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连接出现如下问题:

  解决方法:

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

mysql -u root -p

use mysql;

select host from user where user = 'root'


将host设置为%

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


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

flush privileges;
 

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

您可能感兴趣的文章:
  • Mysql服务器的安装配置与启动关闭方法详解
  • MySQL多实例安装开机自启动服务配置过程
  • mysql5.7单实例自启动服务配置过程
  • MySQL配置主从服务器(一主多从)
  • MySQL在Windows中net start mysql 启动MySQL服务报错 发生系统错误解决方案
  • 5个MySQL GUI工具推荐,帮助你进行数据库管理
  • 数据库管理中19个MySQL优化方法
  • 5个常用的MySQL数据库管理工具详细介绍
  • MySQL数据库管理常用命令小结

www.htsjk.Com true http://www.htsjk.com/Mysql/43971.html NewsArticle MySQL 服务和数据库管理, 目录 1、启动和关闭服务指令 1.1windows下Mysql5.7官方MSI安装地址 1.2、windows下 1.3、linux下 1.4、windows下cmd窗体进入mysql: 1.4、数据库管理 1.5、配置MySQL允许远程访...
评论暂时关闭