Mysql Setup Password

Source: Internet
Author: User
Linux installed after MySQL, the default is no password, the method of setting the root password is as follows: Method One: The simplest method, but also after the installation of MySQL, the system prompt method. Use Mysqladmin to complete. shell> mysqladmin-u root password "newpwd" shell> mysqladmin-u root-h host_name password "newpwd" password the following double quotes are not required Required, but if the password contains spaces or some special symbols, you need to use quotation marks. Method Two: Use MySQL inside the Set password command to complete, note must use the password () function to encrypt the settings of this newpwd, otherwise direct = ' newpwd ' will not take effect. However, if you use the Mysqladmin password to set a password or grant to set it, you do not need to use the password () function, because they have already called the function automatically. Shell> mysql-u rootmysql> set PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' newpwd ');mysql> SET PASSWORD for ' root ' @ ' host_name ' = PASSWORD (' newpwd '); Method Three: Set the password directly via the Update user table shell> mysql-u rootmysql> Update mysql.user Set Password = Password (' newpwd '), WHERE u ser = ' root ';mysql> FLUSH privileges;

Mysql Setup Password

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.