1.解压到安装目录,如:D:\mysql-8.0.12-winx64
2.将以下配置文件粘贴到安装目录,并保存为my.ini,注意:使用ansi 而非utf-8编码格式保存
[mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] # 设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=D:\mysql-8.0.12-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:\mysql-8.0.12-winx64\data # 允许最大连接数 max_connections=20 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB
3.管理员权限进入cmd
4.进入解压目录
>d:
>D:\mysql-8.0.12-winx64\bin
5.安装
>mysqld --initialize --console #记住密码,第一次登录用,一般在 ‘root@localhost:’ 后的一串字符即是
>mysqld install #安装
>net start mysql #启动服务,关闭用 net stop mysql
6.安装
>mysql -u root -p
>键入上面的password
7.修改密码及加密方式
>alter user 'root'@'localhost' identified by 'root'; # 设置新密码 ,如:root,
>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; #更改密码,否则navicat连接时,报2059错误
# 使用 UPDATE user SET authentication_string=PASSWORD("root") WHERE User="root"; 也可以
>ALTER USER 'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER; #更改加密方式,否则navicat连接时,报1251错误
>flush privileges; #刷新权限
8.验证
>show databases;
>use mysql;
>show tables;
>select host, user, authentication_string from mysql.user;
>quit; #exit;
9.R将本地数据写入数据库
install.packages("openxlsx") library('openxlsx') data1 <- read.xlsx("C:/Users/Administrator/Desktop/平台在售商品表.xlsx", sheet = '平台在售商品表') data2 <- read.xlsx('C:/Users/Administrator/Desktop/商品销售信息表.xlsx', sheet = '商品销售信息表') library(RODBC) channel <- odbcConnect('root', uid = 'root', pwd = 'root') sqlSave(channel, data1, rownames = "state", addPK=TRUE) sqlSave(channel, data2, rownames = "state", addPK=TRUE)
10. python连接mysql
11. mysql workbench安装
visual c++ 2019下载
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
https://dev.mysql.com/downloads/workbench/ 点击下图按钮
报错解决:https://blog.csdn.net/weixin_40159138/article/details/87397247
workbench 汉化方法
https://jingyan.baidu.com/article/046a7b3e8d230bf9c27fa928.html
12.参考资料
http://www.runoob.com/mysql/mysql-install.html
https://www.cnblogs.com/zhengyeye/p/8794372.html
Navicat连接mysql8.0.1版本出现1251--Client does not support authentication protocol requested by server的解决