1、MySQL8.0 For Windows zip包下载地址:https://dev.mysql.com/downloads/file/?id=476233
进入页面后可以不登录。后点击底部“No thanks, just start my download.”即可开始下载。
2、或直接下载:https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11-winx64.zip
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir=D:\Mysql\mysql-5.6.39-winx64
datadir=D:\Mysql\mysql-5.6.39-winx64\data
# port = .....
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
mysqld --install MySQL --defaults-file="D:\Mysqlmysql-5.6.39-winx64\my.ini"
MySQL为自定义服务名
net start MySQL
net stop MySQL
注意:用管理员方式运行cmd.exe
mysqld --initialize --console
注意:
8.0需要记住默认密码
5.6默认密码为空
mysql -u root -P3306 -p 123456
端口号:3306
密码:123456
默认配置远程无法访问,需要修改mysql中的ues表
设置:update user set host = '%' where user = 'root';
到此为止Mysql基本配置就已经搭建完成!
远程访问常见问题:
错误信息:2003 -Can't connect to MySQL server on “192.168.1.55” (10060)
排查过程:ip是否写对,端口号是否被防火墙屏蔽(防火墙添加入栈规则端口号)
错误信息:1130-host is not allowed MySQL不允许从远程访问的方法
mysql -u root -p
mysql>use mysql;
mysql>select 'host' from user where user='root';
mysql>update user set host = '%' where user ='root';
mysql>flush privileges;
mysql>select 'host' from user where user='root';
2019-11-14 安装日志:版本mysql-8.0.18-winx64
C:\Users\Administrator>cd E:\Soft\mysql-8.0.18-winx64\mysql-8.0.18-winx64\bin
C:\Users\Administrator>e:
E:\Soft\mysql-8.0.18-winx64\mysql-8.0.18-winx64\bin>mysqld --initialize --consol
e
2019-11-14T05:32:44.983841Z 0 [System] [MY-013169] [Server] E:\Soft\mysql-8.0.18
-winx64\mysql-8.0.18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of serve
r in progress as process 3084
2019-11-14T05:32:44.987509Z 0 [Warning] [MY-013242] [Server] --character-set-ser
ver: 'utf8' is currently an alias for the character set UTF8MB3, but will be an
alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to
be unambiguous.
2019-11-14T05:32:58.707620Z 5 [Note] [MY-010454] [Server] A temporary password i
s generated for root@localhost: ******
E:\Soft\mysql-8.0.18-winx64\mysql-8.0.18-winx64\bin>mysqld install
Service successfully installed.
E:\Soft\mysql-8.0.18-winx64\mysql-8.0.18-winx64\bin>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。
E:\Soft\mysql-8.0.18-winx64\mysql-8.0.18-winx64\bin>mysql -h localhost -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.18
Copyright (c) 2000, 2019, 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> ALTER user 'root'@'localhost' IDENTIFIED BY '123456'
-> ;
Query OK, 0 rows affected (0.15 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1
23456';
Query OK, 0 rows affected (0.05 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)
mysql> SELECT user, host, plugin from mysql.user;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
| root | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
4 rows in set (0.00 sec)
mysql> update mysql.user set host='%' where user='root';
Query OK, 1 row affected (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT user, host, plugin from mysql.user;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| root | % | mysql_native_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
+------------------+-----------+-----------------------+
4 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)