Below we provide six different methods to modify the password of the MySQL Root User and add the MySQL user. Method 1: Use phpMyAdmin, which is the simplest. Modify the user table of the MySQL database, but do not forget to use the password function. Method 2: Use mysqladmin, which is a special case stated above. Mysqladmin-u root-P password mypasswd after entering this command, enter the original root password and change the root password 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 MySQL server, or you cannot execute mysqladmin, this method is invalid. In addition, mysqladmin cannot clear the password. The following methods are used 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 is definitely adding a user, the user name is Jeffrey and the password is Biscuit. I wrote this example in MySQL Chinese reference manual. Be sure to use the password function, and then use flush privileges. Method 4 is similar to method 3, but the replace statement mysql> replace into MySQL is used. user (host, user, password) values ('%', 'Jeffrey ', password ('biscuit'); mysql> flush privileges Method 5 use the set password statement, mysql> set password for Jeffrey @ "%" = PASSWORD ('biscuit'); you must use the password () function, but do not need to use flush privileges. Method 6 use grant... identified by statement mysql> grant usage on *. * To Jeffrey @ "%" identified by 'biscuit'; the password () function is unnecessary and does not need to be flush privileges. Note: Password () [not] implements password encryption in the same way as UNIX password encryption. If MySQL is running, killall-term mysqld is first killed. Start MYSQL: Bin/safe_mysqld -- skip-grant-tables & and you can enter MySQL without a password. Then you can use mysql> Update user SET Password = PASSWORD ("new_pass") where user = "root";> flush privileges; kill MySQL again and start MySql in the normal way.
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.