python test development django-8.windows system installation mysql8 Tutorial

Foreword

MySQL is the most popular relational database management system, you can set up a local mysql environment, easy to learn.

  • windows7/windows10
  • mysql-8.0.11-winx64

Download the installation package

mysql latest installation package can be downloaded directly on the official website [https://dev.mysql.com/downloads/mysql/] , this part to mysql-8.0.11-winx64 version is installed as a case,
mysql-8.0.11-winx64 version direct download: [https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11-winx64.zip]

In this page you can also [https://dev.mysql.com/downloads/file/?id=476233] , enter the page can not log on. Click the bottom of the "No thanks, just start my download ." To start the download.

After the download is complete extract to a local computer directory, such as D: \ soft \ mysql8011

Initial Configuration

After extracting mysql-8.0.11-winx64.zip file in D: \ soft \ mysql8011 \ mysql -8.0.11-winx64 my.ini directory create a profile, as follows:
Incidentally, a new folder Data for mysql a database of stored data: datadir = D: \ soft \ mysql8011 \ mysql-8.0.11-winx64 \ data

[mysqld]
# 设置3306端口
port=3306

# 设置mysql的安装目录 basedir=D:\\soft\\mysql8011\\mysql-8.0.11-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:\\soft\\mysql8011\\mysql-8.0.11-winx64\\Data # 允许最大连接数 max_connections=200 # 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统 max_connect_errors=10 # 服务端使用的字符集默认为UTF8 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB # 默认使用“mysql_native_password”插件认证 default_authentication_plugin=mysql_native_password  [mysql] # 设置mysql客户端默认字符集 default-character-set=utf8  [client] # 设置mysql客户端连接服务端时默认使用的端口 port=3306 default-character-set=utf8

Took over initialization data to the administrator permission to open cmd, cd to the bin directory: D: \ soft \ mysql8011 \ mysql-8.0.11-winx64 \ bin, execute instructions

mysqld --initialize --console

D:\soft\mysql8011\mysql-8.0.11-winx64\bin>mysqld --initialize --console
2018-11-19T07:51:21.287486Z 0 [System] [MY-013169] [Server] D:\soft\mysql8013\my sql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progr ess as process 4664 2018-11-19T07:51:39.104505Z 5 [Note] [MY-010454] [Server] A temporary password i s generated for root@localhost: *kEkIrsF3Av& 2018-11-19T07:51:49.720112Z 0 [System] [MY-013170] [Server] D:\soft\mysql8013\my sql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server has comp leted

从这一句里面找到root用户初始密码 [Note] [MY-010454] [Server] A temporary password i
s generated for root@localhost: *kEkIrsF3Av& ,初始密码就是:*kEkIrsF3Av&,记住它,别关闭了,后面登录会用到

要是你手贱,关快了,或者没记住,删掉初始化的 datadir 目录,再执行一遍初始化命令,又会重新生成的

启动服务

接着上面步骤在bin目录下执行命令:mysqld --install [服务名]

mysqld --install mysql

D:\soft\mysql8011\mysql-8.0.11-winx64\bin>mysqld --install mysql Service successfully installed.

安装完成之后,就可以通过命令net start mysql启动MySQL的服务了。通过命令net stop mysql停止服务

D:\soft\mysql8011\mysql-8.0.11-winx64\bin>net start mysql mysql 服务正在启动 ... mysql 服务已经启动成功。

修改密码

在MySQL安装目录的 bin 目录下执行命令

mysql -u root -p

会提示输入密码,记住了上面第步安装时的密码 *kEkIrsF3Av&:,填入即可登录成功,进入MySQL交互模式

D:\soft\mysql8011\mysql-8.0.11-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.11 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>

在MySQL中执行命令:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yoyo'; Query OK, 0 rows affected (0.38 sec)

修改密码,注意命令尾的一定要有。

Guess you like

Origin www.cnblogs.com/mashuqi/p/10967248.html