PHP Study Notes (4) -- MySQL user password modification [original]

Source: Internet
Author: User
Tags mysql client
Published on blog.csdn.net/zxub

After MySQL is installed, phpMyAdmin is used again, and a problem is found. You cannot create a new database when logging on to MySQL using a common SA user. After re-installing the PHP runtime environment and MySQL database for the second time, I accidentally found that I could create a new database. The strange thing is that I checked it carefully. It turned out to be the config in phpMyAdmin. inc. the first $ cfg ['servers'] [$ I] ['user'] in PHP is not changed. The default root password is null.
The password is blank. Isn't that a vulnerability? I checked a lot of information on the Internet. No. You have to change the password. I checked the password change information and found a method that is most suitable for cainiao. in DOS mode, enter the bin directory of MySQL and enter the command:
Mysqladmin-uroot password New Password
In this way, the password is changed. In this way, I will not clear the password. First use:
After logging on to the mysql-uroot-P password, enter:
Set password for root @ "localhost" = PASSWORD ('');
(Pay attention to the ";", because a command ends with a semicolon. If you forget to enter a semicolon, just enter a semicolon and press Enter, you do not have to re-enter the command .)
After you enter the preceding command, the password is cleared.
Of course, you can also set a new password by clearing the password, as long as you change it to password ("new password") later. I personally think it is more convenient to directly use the mysqladmin command.
After the new password is set. inc. add the new password in PHP. You cannot open the index in phpMyAdmin without knowing how to do so. the PHP page is displayed. #1250-client does not support Authentication Protocol requested by server; consider upgrading MYSQL client, alas ~~ Depressed. I have been looking for some information for a long time, but I still haven't done a good job. Let's take a break and talk about it first. inc. change $ cfg ['servers'] [$ I] ['user'] in PHP to sa. Let's talk about the remaining issues. If you really want to be safe, make a security certificate and protect yourself first ~~~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.