拙网论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 353|回复: 0

MySQL 8.0 的安装及使用

[复制链接]

949

主题

1001

帖子

3736

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3736
发表于 2019-8-12 20:01:15 | 显示全部楼层 |阅读模式

1. 安装了MySql 8,想用SqlYog远程连接,中途遇到问题,最终不仅重新安装了实例,还要保重如下:
用户(我用的root)host为%且plugin为mysql_native_password.


2.存储Json
https://www.cnblogs.com/Soy-technology/p/11050118.html


----
my.ini的位置
  1. C:\ProgramData\MySQL\MySQL Server 8.0
复制代码


查看是否安装成功:
C:\Users\Administrator>mysqld -install
Service successfully installed.

启动MySql:

C:\Users\Administrator>net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。

C:\Program Files\MySQL\MySQL Server 8.0\data 报错
2019-08-12T11:57:34.282069Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld (mysqld 8.0.17) starting as process 2824
2019-08-12T11:57:34.454669Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2019-08-12T11:57:34.455573Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-08-12T11:57:34.464049Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-08-12T11:57:34.466151Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld: Shutdown complete (mysqld 8.0.17)  MySQL Community Server - GPL.

参考文章:https://blog.csdn.net/github_38832708/article/details/83037241

移除MySQL服务:
  1. C:\Users\Administrator>mysqld -remove MySQL
  2. Service successfully removed.
复制代码
重新安装mysql服务:
  1. C:\Users\Administrator>mysqld -remove MySQL
  2. Service successfully removed.

  3. C:\Users\Administrator>mysqld --initialize-insecure

  4. C:\Users\Administrator>mysqld --install
  5. Service successfully installed.

  6. C:\Users\Administrator>net start mysql
  7. MySQL 服务正在启动 ..
  8. MySQL 服务已经启动成功。


  9. C:\Users\Administrator>
复制代码
  1. mysql> show databases
  2.     -> ;
  3. +--------------------+
  4. | Database           |
  5. +--------------------+
  6. | information_schema |
  7. | mysql              |
  8. | performance_schema |
  9. | sys                |
  10. +--------------------+
  11. 4 rows in set (0.01 sec)

  12. mysql> select host,user,plugin from user;
  13. ERROR 1046 (3D000): No database selected
  14. mysql> use mysql
  15. Database changed
  16. mysql> select host,user,plugin from user;
  17. +-----------+------------------+-----------------------+
  18. | host      | user             | plugin                |
  19. +-----------+------------------+-----------------------+
  20. | localhost | mysql.infoschema | caching_sha2_password |
  21. | localhost | mysql.session    | caching_sha2_password |
  22. | localhost | mysql.sys        | caching_sha2_password |
  23. | localhost | root             | caching_sha2_password |
  24. +-----------+------------------+-----------------------+
  25. 4 rows in set (0.00 sec)

  26. mysql> alter user 'root'@'localhost' identified with mysql_native_password by '0314';
  27. Query OK, 0 rows affected (0.03 sec)

  28. mysql> flush privileges;
  29. Query OK, 0 rows affected (0.02 sec)

  30. mysql> select host,user,plugin from user;
  31. +-----------+------------------+-----------------------+
  32. | host      | user             | plugin                |
  33. +-----------+------------------+-----------------------+
  34. | localhost | mysql.infoschema | caching_sha2_password |
  35. | localhost | mysql.session    | caching_sha2_password |
  36. | localhost | mysql.sys        | caching_sha2_password |
  37. | localhost | root             | mysql_native_password |
  38. +-----------+------------------+-----------------------+
复制代码
进入数据库 ,将root的用户的host 属性  设置为%
  1. mysql> use mysql
  2. Database changed
  3. mysql> update user set host='%' where user = 'root';
  4. Query OK, 1 row affected (0.06 sec)
  5. Rows matched: 1  Changed: 1  Warnings: 0

  6. mysql> flush privileges;
  7. Query OK, 0 rows affected (0.02 sec)

  8. mysql>
复制代码



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|抱朴守拙BBS

GMT+8, 2025-5-26 01:19 , Processed in 0.189881 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表