Mysql password change and allow remote logon _ MySQL-mysql tutorial

Source: Internet
Author: User
Tags pkill
This article describes how to change the password of mysql and how to enable remote logon. For more information, see root.

1. have the original root password for myql;

Method 1:

Outside the mysql system, use mysqladmin

# Mysqladmin-u root-p password "test123" Enter password: [Enter the original password]

Method 2:
Log on to the mysql system,

# Mysql-uroot-pEnter password: [enter the original password] mysql> use mysql; mysql> update user set passworD = password ("test") where user = 'root '; mysql> flush privileges; mysql> exit;

2. forget the original root password of myql;

First, you must have the root permission of the operating system. If you do not have the root permission of the system, consider the root system and then follow the steps below.
Similar to logging on to the system in safe mode, it is recommended that you use pkill mysql, but I do not recommend it. Because when you execute this command, it will lead to the following situation:

 /etc/init.d/mysqld statusmysqld dead but subsys locked

In this way, even if you start mysql in safe mode, it may not be useful. d/mysqld stop. if you use pkill, start and stop again.

# mysqld_safe --skip-grant-tables &

The above is all the content of this article. I hope you will like it.

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.