To modify the MySQL database password via the MySQL command line, here is a detailed description of how to use the MySQL command line to modify the password.
Format: Mysqladmin-u username-P Old password password new password
1. Add a password to root pass123:
First enter directory Mysql\bin under DOS, and then type the following command
Mysqladmin-u Root-password pass123
Note: Because Root does not have a password at the beginning, the-p old password can be omitted.
2. Change the root password to pass456.
Mysqladmin-u root-p pass123 Password pass456
The above two are the commands entered on the cmd command line, so the direct carriage return is OK.
the commands in the MySQL environment are described below , with a semicolon as the command terminator at the end of the MySQL command.
3, the command line to modify the root password:
mysql> UPDATE mysql.user SET password=password (' newpassword ') WHERE user= ' root ';
After running this line, you will be prompted with the following information:
Query OK, 0 rows Affected (0.00 sec)
Rows matched:2 changed:0 warnings:0
You also need to run the following sentence, otherwise the password will not be modified:
mysql> FLUSH privileges;
The following run results represent a successful modification:
Query OK, 0 rows affected (0.16 sec)
4. Display the current User:
Mysql> SELECT USER ();
1, Flush: Flush the contents of the buffer, output.
function format: Flush ()
Description: This function is often used and is highly efficient.
2. Ob_start: Open Output buffer
function format: void Ob_start (void)
Note: When the buffer is active, all non-file header information from the PHP program is not sent, but is saved in the internal buffer. In order to output the contents of the buffer, you can use the contents of the Ob_end_flush () or flush () output buffers.
3. Ob_get_contents: Returns the contents of the internal buffer.
How to use: String ob_get_contents (void)
Description: This function returns the contents of the current buffer and returns FALSE if the output buffer is not activated.
4. Ob_get_length: Returns the length of the internal buffer.
How to use: int ob_get_length (void)
Note: This function returns the length of the current buffer, as with ob_get_contents, if the output buffer is not activated. FALSE is returned.
5. Ob_end_flush: Sends the contents of the internal buffer to the browser, and closes the output buffer.
How to use: void Ob_end_flush (void)
Description: This function sends the contents of the output buffer (if any).
6. Ob_end_clean: Delete the contents of the internal buffer and close the internal buffer
How to use: void Ob_end_clean (void)
Description: This function does not output the contents of the internal buffer but deletes it!
7. Ob_implicit_flush: Turn absolute refresh on or off
How to use: void Ob_implicit_flush ([int flag])
Description: People who have used Perl know the meaning of $|=x, this string can open/close the buffer, and the Ob_implicit_flush function is the same, the default is to close the buffer, open the absolute output, each script output is sent directly to the browser, no longer need to call flush ()
command line modify MySQL database password