MySql5.7.11 解压缩版安装以及配置

将mysql压缩包解压后,依次执行如下命令:
将mysql注册到系统服务:
1
mysqld --install MySQL
启动mysql服务:
1
net start MySQL
mysql5.7 之后会自动生成root用户的随机密码,在data文件夹下的${hostname}.err日志文件中:
1
[Note] A temporary password is generated for root@localhost: m7B/rGDOuuhb
以admin身份登陆mysql
1
mysqladmin -u root password "temporary password";
更改root密码
1
set password for root@localhost = password('password');
添加用户并授权
1
GRANT all privileges ON *.* TO 'test'@'localhost' IDENTIFIED BY 'test'
查看用户授权
1
show grants for 'test'@'localhost'
支持中文,设置mysql编码为utf-8

在mysql根目录新建my.ini,复制以下内容并重启mysql

1
2
3
4
5
6
7
8
9
10
11
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
[mysql]
default-character-set = utf8
[mysql.server]
default-character-set = utf8
[mysqld_safe]
default-character-set = utf8
[client]
default-character-set = utf8