版权声明:本站所提供的文章资讯、软件资源、素材源码等内容均为本作者提供、网友推荐、互联网整理而来(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考,如有侵犯您的版权,请联系我,本作者将在三个工作日内改正。 https://blog.csdn.net/weixin_42323802/article/details/82532059
下载地址:https://dev.mysql.com/downloads/mysql
- 可以通过命令net start mysql启动MySQL的服务了。通过命令net stop mysql停止服务。通过命令sc delete MySQL/mysqld -remove卸载 MySQL 服务;
第一步卸载;
安装包安装:
- 解压压缩包(32位操作系统的请解压winx32的压缩包)
- 添加环境变量:
G:\Develop\mysql-8.0.12-winx64中创建配置文件
扫描二维码关注公众号,回复:
3183965 查看本文章
配置文件中复制下面一段进去:
[mysqld]
# Set port 3306
port=3306
# Set up mysql's installation directory
basedir=G:\\Develop\\mysql-8.0.12-winx64
# Remember here that you have to use the double slash to be in the line,
#and I'm going to make a mistake here,
#but I have a single slash in the tutorial. Try it yourself
# Set up a directory of data for the mysql database
datadir=G:\\Develop\\mysql-8.0.12-winx64\\data
# The same as above
# Maximum number of connections
max_connections=200
# Number of connections allowed to fail. This is to prevent someone from trying to
#attack the database system from the host
max_connect_errors=10
# The default character set used by the server is UTF8
character-set-server=utf8
# The default storage engine that will be used when creating a new table
default-storage-engine=INNODB
# By default“mysql_native_password”Plug-in authentication
default_authentication_plugin=mysql_native_password
[mysql]
# Set the mysql client's default character set
default-character-set=utf8
[client]
# Sets the default port used when mysql client connects to the server
port=3306
default-character-set=utf8
进入bin目录,执行以下dos命令:
①mysqld --initialize --console
2018-09-08T11:55:18.250655Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost
: >fAKX1%yy*gS
是初始密码。
②mysqld --install
③启动mysql后(通过命令net start mysql启动MySQL的服务)
在MySQL安装目录的 bin 目录下执行命令:mysql -u root -p
、重置密码即可;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
、、
可选:
创建远程登录用户:
-
管理员root的host是localhost,代表仅限localhost登录访问。如果要允许开放其他ip登录,则需要添加新的host。如果要允许所有ip访问,可以直接修改成“%”;
-
创建用户:
-
-
CREATE USER 'xxh'@'%' IDENTIFIED WITH mysql_native_password BY 'xxh123!@#';
-
grant all on *.* to root@'%'identified by 'password' 设置一个root用户允许远程登录
检查用户:
select user, host, plugin, authentication_string from user\G;
授权所有权限 :
GRANT ALL PRIVILEGES ON *.* TO 'xxh'@'%';
授权基本的查询修改权限,按需求设置:
-
-
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON *.* TO 'xxh'@'%';
查看用户权限。
show grants for 'xxh'@'%';