mysql openssl windows_MySql压缩包安装(zip Archive for Windows)并开启openssl

本文详细介绍了在Windows系统上安装和配置MySQL的过程,包括获取管理员权限、设置安装路径、环境变量,初始化数据目录,启动MySQL服务,修改root用户密码,以及处理可能遇到的网络和SSL配置问题。同时,提供了检查MySQL是否正常工作的命令。
摘要由CSDN通过智能技术生成

释放压缩包

请确认您拥有视窗系统的管理员权限。

选择安装位置。按照惯例,mysql被安装在C:\mysql。

为了操作方便,我们设置一下视窗系统的环境变量。在系统变量中的path,添加路径,比如“C:\mysql\bin”。但是如果你的系统中需要运行多个MySQL服务器,那么就一定不要这样做了。

107a7d7aa6ac46201b00ade9c9e30f3e.png

服务器使用网络端口,默认为3306。请设置防火墙的此端口为开放,或关闭防火墙。

初始化数据目录

使用mysqld手动初始化data目录

执行mysqld命令如下所示:

C:\mysql\bin\mysqld --initialize-insecure --console

注意:如果命令执行失败,请以管理员的身份启动cmd,再执行以上的初始化命令。

从命令行启动mysql

新建批处理文件,mysql.bat。写入内容并执行:

C:\MySQL\bin\mysqld --console

然后执行:mysql -u root --skip-password

在连接后,为root设置新的密码:

注意不要忘记录入最后的分号!两个命令都试一下。

mysql> ALTER USER USER() IDENTIFIED WITH mysql_native_password BY 'password';

或者 mysql>ALTER USER 'root' @ 'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';

系统会提示“Query OK, 0 rows affected (0.01 sec)”,没关系,这就是修改成功了。

注意:WITH mysql_native_password这个参数如果不加的话会报错。客户端连接可能会出现caching-sha2-password问题。

下载openssl在windows系统的安装包http://slproweb.com/products/Win32OpenSSL.html

4ded7a553c7fae0eac84edad0c572c77.png

设置环境变量。

8398475a98dd832573242140cf136659.png

生成密钥。

9b90344a03af6da56b964796bca7ec4f.png

文件说明:

ca.pem               Self-signed CA certificate

ca-key.pem           CA private key

server-cert.pem      Server certificate

server-key.pem       Server private key

client-cert.pem      Client certificate

client-key.pem       Client private key

将生成的文件放到mysql\data文件夹。这样mysql启动后就自动启动ssl了。

检测mysql的安装

You can test whether the MySQL server is working by executing any of the following commands:

C:\> "C:\MySQL\bin\mysqlshow"

C:\> "C:\MySQL\bin\mysqlshow" -u root mysql

C:\> "C:\MySQL\bin\mysqladmin" version status proc

C:\> "C:\MySQL\bin\mysql" test

If mysqld is slow to respond to TCP/IP connections from client programs, there is probably a problem with your DNS. In this case, start mysqld with the --skip-name-resolve option and use only localhost and IP addresses in the Host column of the MySQL grant tables. (Be sure that an account exists that specifies an IP address or you may not be able to connect.)

You can force a MySQL client to use a named-pipe connection rather than TCP/IP by specifying the --pipe or --protocol=PIPEoption, or by specifying . (period) as the host name. Use the --socket option to specify the name of the pipe if you do not want to use the default pipe name.

If you have set a password for the root account, deleted the anonymous account, or created a new user account, then to connect to the MySQL server you must use the appropriate -u and -p options with the commands shown previously. See Section 5.2.2, “Connecting to the MySQL Server”.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值