Mysql数据库安装

一、Mysql数据库的安装 【mysql5.7.29】
windows安装mysql.zip
1.配置环境变量
Mysql数据库安装

2.设置my.ini文件

[mysqld]
#端口号
port = 3306
#mysql的路径
basedir=D:\\Develop Files\\DATABASE\\mysql-5.7.29
#mysql-5.7.27-winx64的路径+\data
datadir=D:\\Develop Files\\DATABASE\\mysql-5.7.29\\data 
#最大连接数
max_connections=200
#编码
character-set-server=utf8 
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# 可以免密
# skip-grant-tables
[mysql]
default-character-set=utf8

[client]
port=3306
default-character-set=utf8

3.安装mysql

# 进入目录
D:\Develop Files\DATABASE\mysql-5.7.29\bin
# 执行安装
bin \> mysqld --initialize --user=mysql --console
bin \> mysqld -install
bin \> net start mysql
bin \> mysql -u root -p
mysql \> use mysql;
mysql \> update user set authentication_string=password("123456") where user="root";

4. 常用myql命令

mysql \> grant all on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant option;
flush privileges;

# 新建用户远程连接
grant all on *.* to admin@‘%‘ identified by ‘123456‘ with grant options;
flush privileges;
# 允许任何IP地址(%表示允许任何IP地址)的电脑使用admin账户和密码来访问mysql;

# 显示数据库报错
3306 [(none)]>show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
## 解决方案:
# ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456‘ PASSWORD EXPIRE never;
# flush privileges;

Mysql数据库安装

上一篇:OSS AccessKey泄露


下一篇:133. Clone Graph(图的复制)