windows 安装mysql

zip安装方式

1.安装服务

mysqld --install

2.初始化注册服务

mysqld --initialize-insecure

3.启动

net start mysql

4.登录

mysql -u root -p

5.修改密码

alter user 'root'@'localhost' identified by '123456';
set password for 'root'@'localhost'= '123456';

6.连接Navicat报错1251

alter user 'root'@'localhost' identified by '123456' password expire never;
alter user 'root'@'localhost' identified with mysql_native_password by '123456';
flush privileges;

Mysql数据库插入中文乱码解决

1. 在MySQL安装的路径下新建my.ini配置文件

# 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]
character-set-server=utf8
default-storage-engine=INNODB
 
# 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 = E:\mysql-5.7.21-winx64\mysql-5.7.21-winx64
 datadir = E:\mysql-5.7.21-winx64\mysql-5.7.21-winx64\data
 port = 3306
 server_id = 1
# basedir = .....
# datadir = .....
# 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
my.ini 配置文件内容

2.重启mysql服务

net stop mysql
net start mysql

安装mysql8.0出现error 1042,无法正常启动

截图如下:

 

 解决方案:

1、打开service服务管理器,找到刚才安装mysql的服务名称

2、右键 --> 属性 --> 登录,更改成“本地系统账户” --> 确定

3、回到安装程序,在次点击Execute,会发现已经可以成功到Finish界面

 

posted @ 2020-10-20 22:16  一柒微笑  阅读(152)  评论(0编辑  收藏  举报