MYSQL的安装教程
1.软件下载
我们可以去官网下载正版MYSQL软件
mysql5.7 64位下载地址:
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-winx64.zip
2.操作步骤
要想使用MYSQL服务 必须先给你的电脑配置环境变量
1.配置环境变量
我的电脑->属性->高级->环境变量
选择PATH,在其后面添加: 你的mysql 安装文件下面的bin文件夹的目录
例如我的是 :E:\MYSQL\mysql-5.7.19-winx64\bin
把这段目录添加到PATH变量中 我们的环境变量就配置成功了
2.编辑my.ini文件
在E:\MYSQL\mysql-5.7.19-winx64下新建my.ini 文件
编辑 my.ini 文件 ,注意替换路径位置
[mysqld]
explicit_defaults_for_timestamp=true
basedir=E:\MYSQL\mysql-5.7.19-winx64
datadir=E:\MYSQL\mysql-5.7.19-winx64\data
port=3306
3.安装mysql服务
启动管理员模式下的CMD,并将路径切换至mysql下的bin目录,然后输入mysqld –install (安装mysql)
注意事项:必须是管理员模式下的CMD 否则会出现安装报错
4.初始化数据
再输入 mysqld --initialize-insecure --user=mysql 初始化数据文件
5.进入MYSQL管理系统
然后再次启动mysql 然后用命令 mysql –u root –p 进入mysql管理界面(密码可为空)
update mysql.user set authentication_string=password(‘123456’) where user=‘root’ and Host = ‘localhost’;
输入以上代码 进入界面后更改root密码
6.修改 my.ini文件
删除最后一句skip-grant-tables
重启mysql即可正常使用 net stop mysql net start mysql
7.验证安装是否成功
在管理员模式下的命令行输入 mysql -uroot -p123456
如果出现以下代码则测试成功
C:\WINDOWS\system32>mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.7.19 MySQL Community Server (GPL)
Copyright © 2000, 2017, 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.