PHP experts: Title summary (2)

Source: Internet
Author: User
[Recall]: "debugging program" and "how to apply session" are introduced in the previous collection ", 15 titles, such as "standard SQL statements" (Php experts take the lead-title summary and answer [1]). This set continues to provide answers to 16 common titles. 16: I want to modify the MySQL User. the password must be declared first.

  [Recall]:The previous set first introduced 15 headers, such as 'debug project', 'How to apply session', and 'standardized SQL statement' (Php experts take the lead-title summary and answer [1]). This set continues to provide answers to 16 common titles.

16: I want to modify the MySQL User and password.
First, we need to declare that, in most cases, MySQL must have the root permission in mysql,

Therefore, the password cannot be changed unless the administrator is requested.

  Method 1

Phpmyadmin is the most simple application. modify the user table of the mysql database,

But don't forget to apply the PASSWORD function.

  Method 2

The application mysqladmin is a special case stated above.

Mysqladmin-u root-p password mypasswd

After entering this command, you need to enter the original root password, and then the root password will be changed to mypasswd.

Change the root in the command to your username, and you can change your password.

Of course, if your mysqladmin cannot connect to the mysql server, or you have no way to fulfill mysqladmin,

This method is invalid.

In addition, mysqladmin cannot clear the password.
The following methods are applied at the mysql prompt and must have the root permission of mysql:

  Method 3

Mysql> insert into mysql. user (Host, User, Password)

VALUES ('%', 'Jeffrey ', PASSWORD ('biscuit '));

Mysql> FLUSH PRIVILEGES

Indeed, this is adding a user with the username jeffrey and password biscuit.

I wrote this example in mysql Chinese Reference Manual.

Be sure to apply the PASSWORD function, and then apply flush privileges.

  Method 4

Similar to method Sany, only the REPLACE statement is applied.

Mysql> replace into mysql. user (Host, User, Password)

VALUES ('%', 'Jeffrey ', PASSWORD ('biscuit '));

Mysql> FLUSH PRIVILEGES

  Method 5

Apply the set password statement,

Mysql> set password for jeffrey @ '%' = PASSWORD ('biscuit ');

You must also apply the PASSWORD () function,

However, you do not need to apply flush privileges.

  Method 6

Apply the GRANT... identified by statement

Mysql> grant usage on *. * TO jeffrey @ '%' identified by 'biscuit ';


Here, the PASSWORD () function is unnecessary and does not need to be applied to flush privileges.
Note: PASSWORD () [not] implements PASSWORD encryption in the same way as Unix PASSWORD encryption.


17: I want to know which website he connected to this page
PHP code:

  
// Output is available only when input through the super connection.

Echo $ _ SERVER ['http _ referer'];

?>

18: put the data into the database and extract it. what should I pay attention to on the page?
Database entry

$ Str = addslashes ($ str );

$ SQL = 'Insert into 'tab' ('content') values ('$ str ')';

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.