下载地址:https://dev.mysql.com/downloads/mysql/

mysql 配置

下载完直接解压,然后配置下环境变量。

mysql 配置

然后Windows搜索框输入cmd,以管理员身份打开.否则执行mysqld -install会报错。

执行命令:mysqld --initialize-insecure --user=mysql  在sql目录下生成data目录,这个应该是存放数据库的目录。

执行命令:net start mysql  启动mysql服务

如果失败则执行命令:mysqld -install  

然后在net start mysql  启动mysql服务就行了。

 

接下来设置mysql的密码。刚安装的mysql是没有密码的,我们在命令行输入mysql -u root -p 然后直接按回车就能进去。

查询用户密码命令:mysql> select host,user,authentication_string from mysql.user;

设置密码前需要注意在mysql 5.7.9以后废弃了password字段和password()函数,当然也不能update user set authentication_string="newpassword" where user="root";这样设置。因为authentication_string字段下只能是mysql加密后的41位字符串密码;其他的会报格式错误;

如果当前root用户authentication_string字段下有内容,先将其设置为空,否则直接下一步。

1.use mysql;

 update user set authentication_string='' where user='root'

2.ALTER user 'root'@'localhost' IDENTIFIED BY '123456'

这样数据库就安装完成了。

 

然后使用navicat连接数据库。发现报“2059 authentication plugin‘caching_sha2_password’ cannot be loaded”这个问题,这是因为数据库里面的plugin不一样造成的。这样改就可以了。

mysql 配置

然后就可以使用navicat连接了。

相关文章:

  • 2021-06-13
  • 2021-12-22
  • 2022-12-23
  • 2021-11-04
  • 2021-11-29
  • 2021-11-29
  • 2021-08-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2021-04-30
  • 2021-05-20
  • 2021-07-30
相关资源
相似解决方案