MySQL8.0安装教程及数据库可视化2.2 配置环境变量
2.3 配置初始化的my.ini⽂件
在安装根⽬录下添加 my.ini(新建⽂本⽂件,将⽂件类型改为.ini),
写⼊基本配置:
[mysqld]
# 设置3306端⼝
port=3306
# 设置mysql的安装⽬录
basedir=D:\\Lenovo\\MySQL  # 切记此处⼀定要⽤双斜杠\\,单斜杠我这⾥会出错,不过看别⼈的教程,有的是单斜杠。⾃⼰尝试吧# 设置mysql数据库的数据的存放⽬录
datadir=D:\\Lenovo\\MySQL\\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
3、安装mysql
在安装时,必须以管理员⾝份运⾏cmd,否则在安装时会报错,会导致安装失败的情况
mysqld --initialize --console
执⾏完成后,会打印 root ⽤户的初始默认密码,⽐如:
C:\WINDOWS\system32>D:
D:\>cd D:\Lenovo\MySQL\bin
D:\Lenovo\MySQL\bin>mysqld --initialize --console
2019-06-13T15:59:38.541223Z 0 [System] [MY-013169] [Server] D:\Lenovo\MySQL\ (mysqld 8.0.16) initializing of server in progress as process 14244
2019-06-13T15:59:38.590713Z 0 [Warning] [MY-013242] [Server] --character-set-server: '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-06-13T16:00:06.190039Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: k:ww7Og7lCDg
2019-06-13T16:00:19.710063Z 0 [System] [MY-013170] [Server] D:\Lenovo\MySQL\ (mysqld 8.0.16) initializing of server has completed
注意!执⾏输出结果⾥⾯有⼀段:
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost:k:ww7Og7lCDg
其中root@localhost:后⾯的“k:ww7Og7lCDg”就是初始密码(不含⾸位空格)根据实际⽣成,请牢记,后⾯登录需要
mysql windows安装教程3.2 安装服务
在MySQL安装⽬录的 bin ⽬录下执⾏命令:
mysqld --install [服务名](服务名可以不加默认为mysql)
D:\Lenovo\MySQL\bin>mysqld --install
Service successfully installed.
服务安装成功之后
通过命令net start mysql启动MySQL的服务
通过命令net stop mysql启动MySQL的服务
通过命令sc delete MySQL/mysqld -remove卸载 MySQL 服务
4.进⼊mysql
⽆密码进⼊
mysql  -u root
或有密码进⼊
mysql -u root -p
初始密码为步骤3中root@localhost:后⾯的“字符串“
D:\Lenovo\MySQL\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.16
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>
5、更改密码
在MySQL中执⾏命令:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';  修改密码为123(可⾃⾏设定),注意命令尾的;⼀定要有,这是mysql的语法
6、mysql退出:mysql > exit;
mysql退出三种⽅法:
mysql > exit;
mysql > quit;
mysql > \q;
7、数据库图形化⼯具Navicat
分享⼀个免安装的Navicat Premium 12
我们的MySQL的服务已经开启了就直接打开的Navicat去连接!
新建的MySQL的连接
输⼊步骤5修改后的密码
测试⼀下!
MySQL的是成功安装了也可以登录

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。