大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说Mysql免安装版(windows)配置[通俗易懂],希望您对编程的造诣更进一步.
1.下载
下载地址:dev.mysql.com/downloads/f…
![Mysql免安装版(windows)配置[通俗易懂]插图1 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
2.安装目录下新建文件my.ini
注意:安装目录下不要新建空文件夹data,这是配置服务自动会生成的
![Mysql免安装版(windows)配置[通俗易懂]插图3 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
[client]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\my_tool\mysql-8.0.21-winx64\mysql-8.0.21-winx64
# 设置 mysql数据库的数据的存放目录
datadir=D:\my_tool\mysql-8.0.21-winx64\mysql-8.0.21-winx64\data
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
3.配置环境变量
![Mysql免安装版(windows)配置[通俗易懂]插图5 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
4.cmd下以管理员身份配置
1)进入安装目录
![Mysql免安装版(windows)配置[通俗易懂]插图7 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
2)将MySQL加入到Windows的服务中
mysqld --install
![Mysql免安装版(windows)配置[通俗易懂]插图9 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
3)初始化数据库(初始化成功后会创建data文件夹、最后一行是生成的初始用户名和密码)
mysqld --initialize --user=root --console
![Mysql免安装版(windows)配置[通俗易懂]插图11 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
4)启动mysql服务
net start mysql
![Mysql免安装版(windows)配置[通俗易懂]插图13 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
5) 进入MySQL修改初始密码
mysql -u root -p
# password输入生成的一串初始密码
# 修改初始密码(xxx为你想修改的密码)
alter user user() identified by "XXX";
![Mysql免安装版(windows)配置[通俗易懂]插图15 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
![Mysql免安装版(windows)配置[通俗易懂]插图17 Mysql免安装版(windows)配置[通俗易懂]](https://daima100.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
6) navicat链接MySQL报错
client does not support authentication protocol requested by server
因为mysql8使用了新的caching_sha2_password和sha256_password认证方式,不是mysql_native_password认证方式
解决方案:
alter user 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'XXX';
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/12868.html