首先要安装MySQL 数据库才可以继续安装图形工具SQLyog
第一步:下载解压包》》
MYSQL官网地址:https://dev.mysql.com/downloads/file/?id=479669
绿色安装 直接解压即可。
第二步》》环境变量配置
解压之后放入E盘,需在系统进行环境变量配置
==============================================================================
第三步》》mysql初始化配置
接下来连接和启动数据库操作:
3.1 创建初始化配置my.ini配置文件 存放根目录下面 复制下面文档(需修改路径)
[mysqld]
# 设置3306端口
port=
# 设置mysql的安装目录
basedir=E:\\mysql\\mysql-8.0.-winx64 # 切记此处一定要用双斜杠\\,单斜杠我这里会出错。
# 设置mysql数据库的数据的存放目录
datadir=E:\\mysql\\mysql-8.0.-winx64\\Data # 此处同上
# 允许最大连接数
max_connections=
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=
default-character-set=utf8
3.2 在c:\Windows\system32 找到cmd.exe 右键以系统管理员身份启动该程序
指令路径切换到bin目录下输入指令:
//生成临时密码
mysqld --initialize --console
示例:
E:\mysql\mysql-8.0.-winx64\bin>mysqld --initialize --console
--03T03::.275614Z [System] [MY-] [Server] E:\mysql\mysql-8.0.-winx64\bin\mysqld.exe (mysqld 8.0.) initializing of server in progress as process
--03T03::.017614Z [Note] [MY-] [Server] A temporary password is generated for root@localhost: oZig3fdGSh<E
--03T03::.090414Z [System] [MY-] [Server] E:\mysql\mysql-8.0.-winx64\bin\mysqld.exe (mysqld 8.0.) initializing of server has completed
oZig3fdGSh<E 为系统随机生成的临时密码
3.3 安装mysql 服务
mysqld --install
示例:
E:\mysql\mysql-8.0.-winx64\bin>mysqld --install
Service successfully installed.
3.4 启动mysql服务
net start mysql
示例:
E:\mysql\mysql-8.0.-winx64\bin>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。
3.5 进入mysql 输入以下指令之后 需要输入临时密码
mysql -u root -p
示例:
E:\mysql\mysql-8.0.-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 8.0. Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
3.6 修改临时密码
修改密码为root
alter user user() identified by "root";
示例:
mysql> alter user user() identified by "root";
Query OK, rows affected (0.25 sec)
修改完密码 退出数据库操作
mysql> exit
Bye
3.7 验证密码
E:\mysql\mysql-8.0.-winx64\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 8.0. MySQL Community Server - GPL Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
ok mysql安装完成了密码也修改成功了 命令行操作麻烦,推荐使用图形化工具SQLyog。