How to reset the root password of the mysql server in ubuntu

Source: Internet
Author: User

In ubuntu, how does one reset the root password of the mysql server and install mysql 5 server in ubuntu? Why, the root account password entered during installation cannot be verified by the database server in any way. Instead, you only need to reset the password of the mysql root Account. Check that the root account password is successfully reset using the following methods. First stop the mysql service: www.2cto.com root @ webserver:/home/webmaster # service mysql stop and then re-create a mysql service in the ignore Password Authentication Mode: root @ webserver: /home/webmaster # mysqld -- user = mysql -- skip-grant-tables -- skip-networking & after successful startup, the PID and other startup information are returned: 1 [1] 3591 2 root @ webserver:/home/webmaster #121005 2:59:27 [Note] Plugin 'federated 'is disabled. 3 121005 2:59:27 InnoDB: The InnoDB memory heap is disabled 4 121005 2:59:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins 5 121005 2:59:27 InnoDB: Compressed tables use zlib 1.2.3.4 6 121005 2:59:27 InnoDB: initializing buffer pool, size = 128.0 M 7 121005 2:59:27 InnoDB: Completed initialization of buffer pool 8 121005 2:59:27 InnoDB: highest supported file format is Barracuda. 9 121005 2:59:27 InnoDB: Waiting for the background threads to start10 121005 2:59:28 InnoDB: 1.1.8 started; log sequence number 159568511 121005 2:59:28 [Note] mysqld: ready for connections.12 Version: '5. 5.24-0ubuntu0. 12.04.1 'socket: '/var/run/mysqld. sock 'port: 0 (Ubuntu) www.2cto.com connect to the mysql System Library: root @ webserver: /home/webmaster # mysql-u root mysql connects to the mysql database and directly changes the password of the root account to the new password 'mynewpasswd': Type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> update user set Password = PASSWORD ('mynewpasswd') where user = 'root'; Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> flush privileges; mysql> quit; Bye www.2cto.com stop the mysql service process (for PID 3591, see the screen information when the service is started): root @ webserver: /home/webmaster # kill 3591 start the mysql service normally and log on to the mysql server with a new password: root @ webserver:/home/webmaster # service mysql startroot @ webserver: /home/webmaster # mysql-u root-pmynewpasswd

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.