mysql海盗王_mysql 安装及设置

mysql下载安装记录

设备情况:win10,之前没有进行过mysql安装。

一下载:直接官网下载,https://dev.mysql.com/downloads/file/?id=490026 下载的是解压版的。版本8.0.18 压缩包270M左右。下载完之后解压。

二安装 : 参照 https://www.runoob.com/mysql/mysql-install.html 注意:cmd要用 【管理员权限】启动->在这里C:\Windows\System32\cmd.exe 然后运行到mysqld -install的时候

下一步net start mysql 可能会出错:

D:\mysql-8.0.18-winx64\bin>net start mysql

发生系统错误 193。

*** 不是有效的 Win32 应用程序。

这时候看这篇博客,原理好像是第一次默认安装在c盘,需要手动删除,然后remove一下,再次安装,就到你的指定的目录了。然后再net启动,就成功了

https://blog.csdn.net/qq_35164169/article/details/77863600

下面是我的安装过程;

C:\Windows\system32>d:

D:\mysql-8.0.18-winx64\bin>mysqld install

Service successfully installed.

D:\mysql-8.0.18-winx64\bin>net start mysql

发生系统错误 193。

*** 不是有效的 Win32 应用程序。

D:\mysql-8.0.18-winx64\bin>mysqld install

The service already exists!

The current server installed: C:\Windows\system32\mysqld MySQL

D:\mysql-8.0.18-winx64\bin>c:

C:\Windows\System32>d:

D:\mysql-8.0.18-winx64\bin>mysqld remove

Service successfully removed.

D:\mysql-8.0.18-winx64\bin>mysqld -install

Service successfully installed.

D:\mysql-8.0.18-winx64\bin>mysqld -install

The service already exists!

The current server installed: D:\mysql-8.0.18-winx64\bin\mysqld MySQL

D:\mysql-8.0.18-winx64\bin>net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

D:\mysql-8.0.18-winx64\bin>mysql -u root -p

Enter password: ************

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.18

Copyright (c) 2000, 2019, 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>

到这里就安装完成了,且完成了登录。

cd D:\mysql-8.0.18-winx64\bin

Xkm?o-

D:\mysql-8.0.18-winx64\bin>

D:\mysql-8.0.18-winx64\bin>mysqld --initialize --console

2019-10-28T00:52:20.344670Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 12956

2019-10-28T00:52:21.724707Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Xkm?o-

D:\mysql-8.0.18-winx64\bin>mysqld --initialize --console

2019-10-28T00:58:45.711083Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 1104

2019-10-28T00:58:45.712542Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.

2019-10-28T00:58:45.712555Z 0 [ERROR] [MY-013236] [Server] The designated data directory D:\mysql-8.0.18-winx64\data\ is unusable. You can remove all files that the server added to it.

2019-10-28T00:58:45.718481Z 0 [ERROR] [MY-010119] [Server] Aborting

2019-10-28T00:58:45.719322Z 0 [System] [MY-010910] [Server] D:\mysql-8.0.18-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.18) MySQL Community Server - GPL.

# datadir=D:\mysql-8.0.18-winx64

//这个可以用 先创建用户,然后分配权限;%可以远程连接 修改后可以在workbench上登录

CREATE USER 'zhangsan'@'%' IDENTIFIED BY '123456';

GRANT ALL PRIVILEGES ON lskj.* TO 'zhangsan'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

//修改远程登录方法 可以在vs上使用。

ALTER USER 'zhangsan'@'%' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;

ALTER USER 'zhangsan'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

FLUSH PRIVILEGES;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装MySQL时,可以通过以下步骤来设置密码: 1. 下载并安装MySQL软件。可以从MySQL官方网站下载适合的安装包,根据操作系统进行安装。 2. 执行安装程序,按照向导的指引完成安装过程。在安装过程中,可以选择特定的安全设置。选择开启“Use Strong Password Encryption for Authentication”选项,以使用更强的密码加密方式。 3. 完成安装后,打开命令提示符或终端窗口,并通过管理员权限登录MySQL服务器。 4. 在MySQL命令行界面输入以下命令以设置新密码: ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; 其中,'root'是用户名,“localhost”是主机名,“new_password”是新密码。可以根据实际情况修改用户名、主机名和新密码。 5. 完成密码设置后,可以通过以下命令退出MySQL命令行界面: quit; 至此,新安装MySQL的密码设置完成。 在MySQL 8.0中,引入了一种新的密码认证方式—caching_sha2_password。默认情况下,新安装MySQL 8.0将使用此新的认证方式来加密密码。 使用caching_sha2_password方式,可以提供更高的安全性。它使用SHA-256算法对密码进行哈希加密,并将加密结果存储在mysql.user系统表中的authentication_string列中。 旧版本的MySQL客户端可能无法连接到使用caching_sha2_password认证方式的MySQL服务器。如果需要兼容旧版本的客户端,可以在创建用户时使用以下语句来指定旧的认证方式: CREATE USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; 其中,“username”是用户名,“localhost”是主机名,“password”是密码。使用mysql_native_password认证方式可以使得旧版本的客户端能够连接到MySQL服务器。 总结来说,安装MySQL时可以通过ALTER USER命令设置新密码,而MySQL 8.0引入了新的caching_sha2_password认证方式,提供更高的安全性,但需要注意与旧版本客户端的兼容性问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值