mysql 安装

1 官网下载 mysql-5.7.34-winx64 (目前到8了,但项目使用的是5)

2 解压缩

3 设置环境变量D:\work\mysql-5.7.34-winx64

4 启动服务

遇到个错误:mysql 安装问题:由于找不到MSVCP120.dll,无法继续执行代码.重新安装程序可能会解决此问题。 - 烈焰与暖阳 - 博客园 (cnblogs.com)

-- 注意:管理员身份启动命令行,定位到msyql的安装目录下
d:\work\mysql-5.7.34-winx64\bin>mysqld -install 
Service successfully installed.

--启动server
d:\work\mysql-5.7.34-winx64\bin>net start MySQl
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

-- 默认root ,无密码,修改为root
d:\work\mysql-5.7.34-winx64\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.34 MySQL Community Server (GPL)

mysql> select host,user,authentication_string from mysql.user;
+-----------+---------------+-------------------------------------------+
| host      | user          | authentication_string                     |
+-----------+---------------+-------------------------------------------+
| localhost | root          |                                           |
| localhost | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | mysql.sys     | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
+-----------+---------------+-------------------------------------------+
3 rows in set (0.00 sec)

mysql> use mysql;
Database changed

-- 修改密码
mysql> alter user 'root'@'localhost' identified with mysql_native_password by 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

d:\work\mysql-5.7.34-winx64\bin>mysql -uroot -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.34 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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>

如何查看服务启动时加载配置文件在何处?

my.ini

通过help,查看ini所在位置

C:\Windows\system32>mysqld --verbose --help >test1.txt

C:\Windows\system32>more test1.txt
...

Default options are read from the following files in the given order:
C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf D:\work\mysql-5.7.34-winx64\my.ini D:\work\mysql-5.7.34-winx64\my.cnf

...

安装,移除服务

C:\Windows\system32>mysqld --install mysql
Service successfully removed.
C:\Windows\system32>mysqld --remove  mysql
Service successfully removed.

启动,停止服务

C:\Windows\system32>net start mysql
请求的服务已经启动。

C:\Windows\system32>net stop mysql

进入mysql客户端

C:\Windows\system32>mysql -uroot -proot
--查看binlog相关配置

mysql> show variables like 'log%';

查看服务启动失败日志

D:\work\mysql-5.7.34-winx64\bin>mysqld --console

默认不指定my.ini,如果指定的话,copy了配置模板后,改名为my.ini

这个文件不是即刻就能使用的,里面有一些配置留空了,需要挨个配置上值才可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值