首页 > 数据库技术 > 详细

2 数据库开发--MySQL下载(windows)

时间:2018-10-07 15:55:43      阅读:307      评论:0      收藏:0      [点我收藏+]
Windows:(mysql)
操作:

0.下载安装mysql
    www.mysql.org
    downloads->进入社区community
    community 5.7.21
    下载5.6 Microsoft Windows
    解压到C:  C:\mysql-5.6.39-winx64
    C:\mysql-5.6.39-winx64\bin
        bin/mysql   客户端
        bin/mysqld  服务端
    设置环境变量:
        我的电脑 属性 高级系统设置 环境变量
        系统变量 Path 新建 将 前面加;  D:\mysql\mysql-5.6.41-winx64\bin 粘贴 确定...
    启动cmd:
        >>>:mysqld
        >>>:mysql
    将mysqld做成系统服务,开机自动启动:
        1.先杀死之前开启的mysqld:
          技术分享图片
           技术分享图片
2.制作系统服务:
            C:\Users\Administrator>mysqld --install   制作系统服务
            Service successfully installed.
            C:\Users\Administrator>mysqld --remove    解除系统服务
            Service successfully removed.
技术分享图片
3.服务
            服务-->MySQL-->启动-->ok...
            或者:
            C:\Users\Administrator>net start MySQL
                MySQL 服务正在启动 .
                MySQL 服务已经启动成功。

            C:\Users\Administrator>net stop MySQL
                MySQL 服务正在停止.
                MySQL 服务已成功停止。

1.验证安装成功
C:\Users\Administrator>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.6.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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> select user(); 注意标点符号也要加
+----------------+
| user() |
+----------------+
| ODBC@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> exit
Bye
2. root默认没有密码
技术分享图片
3.设置初始密码:
技术分享图片
4.修改密码
技术分享图片

 

5.忘记密码,破解密码,跳过授权表;

 C:\Users\Administor>net stop MySQL
MySQL 服务正在停止.
MySQL 服务已成功停止。

C:\Users\Admininstor>mysqld --skip-grant-tables # 跳过授权表 启动 mysqld
技术分享图片

 

 C:\Users\Administor>mysql -uroot -p    # 跳过了授权 不需要输入密码了
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.6.39 MySQL Community Server (GPL)

    Copyright (c) 2000, 2018, 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> select user();
    +--------+
    | user() |
    +--------+
    | root@  |
    +--------+
    1 row in set (0.00 sec)

    mysql> update mysql.user set password=password("123") where user="root" and host="localhost";   # 修改密码
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0

    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    mysql> exit
    Bye

    C:\Users\Administor>mysql -uroot -p123   # 修改密码成功
    Warning: Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 11
    Server version: 5.6.39 MySQL Community Server (GPL)

    Copyright (c) 2000, 2018, 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> select user();
    +----------------+
    | user()         |
    +----------------+
    | root@localhost |
    +----------------+
    1 row in set (0.00 sec)

    mysql> exit
    Bye

# 杀死之前 开启的 跳过授权的 mysqld
C:\Users\Administrator>tasklist | findstr mysql
mysqld.exe 6460 Console 1 453,740 K

C:\Users\Administrator>taskkill /F /PID 66732
成功: 已终止 PID 为 6460 的进程。

C:\Users\Administrator>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

C:\Users\Administrator>mysql -uroot -p123 # 用之前设置的密码 登录便可
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> exit
Bye

 

>mysql 套接字客户端

6.登录mysql的两种方式:
    C:\Users\Administrator>mysql -uroot -p123
    C:\Users\Administrator>mysql -uroot -p123 -h 127.0.0.1 -P 3306  # 默认端口是3306
    Warning: Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 8
    Server version: 5.6.39 MySQL Community Server (GPL)

    Copyright (c) 2000, 2018, 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> select user();
    +----------------+
    | user()         |
    +----------------+
    | root@localhost |
    +----------------+
    1 row in set (0.00 sec)

    mysql> exit
    Bye

    C:\Users\Administrator>mysql -h 127.0.0.1 -P 3306
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 9
    Server version: 5.6.39 MySQL Community Server (GPL)

    Copyright (c) 2000, 2018, 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> select user();
    +----------------+
    | user()         |
    +----------------+
    | ODBC@localhost |
    +----------------+
    1 row in set (0.00 sec)

    mysql> exit
    Bye

 7.统一字符编码:

技术分享图片

修改安装目录下的mysql配置文件

技术分享图片

新建配置文件my.ini

粘贴内容:

#mysql5.5以上:修改方式有所改动
----------------------------------- [mysqld] character-set-server=utf8 collation-server=utf8_general_ci [client] default-character-set=utf8 [mysql] default-character-set=utf8
----------------------------------
#2. 重启服务
#3. 查看修改结果:
\s
show variables like ‘%char%‘

 

技术分享图片

 

2 数据库开发--MySQL下载(windows)

原文:https://www.cnblogs.com/foremostxl/p/9750255.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!