Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if php7 can't connect to mysql8?

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

What should we do if php7 is not connected to mysql8? for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

How to solve the problem that php7 can't connect to mysql8?

Mysql 8 php 7 connection failure solution

Failed to authorize the connection when connecting to mysql 8, as shown in the error:

Warning: mysqli::__construct (): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\ DISK\ apache\ Apache24\ htdocs\ oop\ data\ sql.php on line 35

Connect Error (Access denied for user 'root'@'localhost' (using password: YES))

ERROR 1045 (28000) will also appear when logging in under the Cmd command

To find the reason on the Internet, the login method of version 8 was changed to caching_sha2_password, so the login method of users in the database was modified as follows:

1. Log in using the mysql tool window

2, enter the command:

Use mysql

Select user,host,plugin from user; (view user authentication method)

Update user set plugin='mysql_native_password' where User='root'

FLUSH PRIVILEGES

Question 1:

Cmd login mysql appears

Error 2003 (HY000): Can not connect to MySQL server on 'localhost' (10061)

Steps:

1. Check whether the mysql process is started or not. Under the cmd window, net start mysql the process name.

When 2.mysql starts, add port information: mysql-u root-P port number-p

Question 2:

When Cmd logs in, it appears

Error 2007 protocal mismatch the server version = 11 the client version = 10

Using the mysql community tool, re-check the configuration during the update and find that the server port or the modification does not take effect. If you look at the configuration again, it turns out to be modified to the client port. Therefore, the client port is modified to be consistent with the server. Then log in using cmd.

The answer to the question about what to do if php7 is not connected to mysql8 is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report