目录

安装

1、官网下载zip

2、解压,复制到指定目录。新建data文件。添加环境变量

3、新建my.ini文件

4、管理员运行命令行窗口 配置MySQL

5、启动mysql服务

6、启动登录

7、使用数据库

8、建数据库、建表

9、查看mysql版本

使用

1、启动mysql服务

2、启动登录

3、使用数据库

4、常用操作

创建数据库

创建表

插入数据

选择数据


 

安装

1、官网下载zip

MySQL8.0.15安装、使用教程

MySQL8.0.15安装、使用教程

 

2、解压,复制到指定目录。新建data文件。添加环境变量

MySQL8.0.15安装、使用教程

MySQL8.0.15安装、使用教程

 

3、新建my.ini文件

MySQL8.0.15安装、使用教程

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\\MySQL\\mysql-8.0.15-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\MySQL\\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8

4、管理员运行命令行窗口 配置MySQL

进入bin目录,执行命令

MySQL8.0.15安装、使用教程
mysqld --install --console

再执行
mysqld --initialize --console

MySQL8.0.15安装、使用教程
记住密码:kf,aaCx:I6Rq(不含首位空格)

 

5、启动mysql服务

net start mysql

说服务名无效

mysqld --install --console根据提示说服务已经存在,但还是服务名无效,后来我把console参数去掉,执行
mysql --install
显示服务安装成功,然后启动
net start mysql
启动成功。

(停止服务:net stop mysql)

MySQL8.0.15安装、使用教程

 

 

6、启动登录


mysql -u root -p
回车,输入默认的那个极其安全的密码。

MySQL8.0.15安装、使用教程

使用数据库:
use mysql
它会提示你先要重新设置密码。执行

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

此时密码改为了 123456。

MySQL8.0.15安装、使用教程

7、使用数据库

MySQL8.0.15安装、使用教程

 

遇到这个错,Access denied for user 'root'@'localhost' (using password: YES) 这个登录报错,

其实是我命令输错了

MySQL8.0.15安装、使用教程

参考解决的博文在此处:解决win10下MySQL 8.0登录Access denied for user 'root'@'localhost' (using password: YES)的问题

8、建数据库、建表

MySQL8.0.15安装、使用教程

 

9、查看mysql版本

MySQL8.0.15安装、使用教程

 

使用

1、启动mysql服务

net start mysql

要管理员启动

(停止服务:net stop mysql)

2、启动登录

mysql -u root -p

3、使用数据库

show databases;

use test;

show tables;

quit

net stop mysql

 

4、常用操作

创建数据库

create database test;

创建表

create table student(
    -> id integer,
    -> name varchar(8),
    -> password varchar(20));

插入数据

insert into student(id,name,password)
    -> value(1001,"xx",123456);

选择数据

select * from student;

 

 

链接:https://pan.baidu.com/s/1_hwA3y3ec39bDZ7LlzJimw 
提取码:b76x 

打开exe,创建MySQL连接

MySQL8.0.15安装、使用教程

连接成功图标是绿色的

MySQL8.0.15安装、使用教程

 

 

 

相关文章:

  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2021-04-14
  • 2022-01-15
  • 2022-12-23
  • 2021-12-29
  • 2021-12-05
猜你喜欢
  • 2021-05-02
  • 2021-12-10
  • 2021-11-20
  • 2021-11-20
  • 2021-07-19
  • 2022-12-23
相关资源
相似解决方案