Solution to installation failure of MySQL5.6 management account in linux _ MySQL

Source: Internet
Author: User
Solution to installation failure of MySQL5.6 management account in linux bitsCN.com

Solution to installation failure of MySQL5.6 management account in linux

This is not an article, just to record the time I spent this afternoon for no reason. To avoid wasting the same time next time, I should record the problems and solutions I encountered today.

MySQL is not complex, but since a certain version, MySQL installation has become more and more complex. I don't understand why they did this because they were acquired by oracle?

I use redhat and install MySQL 5.6. The installation file is an rpm package. Briefly describe the normal MySQL rpm Package installation process:

Redhat usually comes with a mysql. you must uninstall it first, otherwise the installation will conflict.

If yum exists, you can run

1

> Yum list mysql-client

2

> Yum list mysql-server

To find the installed mysql.

Run

1

> Yum remove package-name

To delete mysql packages.

If yum is not available, you can use

1

> Rpm-qal | grep mysql

List installed RPMs. use

1

> Rpm-e package-name

.

Last run Command

1

> Whereis mysql

To view the directories without mysql, use the rm command to delete all the legacy directories.

Use

1

> Rpm-ivh mysql-package-name

To install Mysql. Generally, the two packages that must be installed are mysql-server and mysql-client. Mysql-client provides query and management tools such as mysql and mysqladmin.

The rpm installation will automatically call the mysql_install_db command, which is the user table of our populate database. This table is stored in mysql. The Table named "user. rpm" will automatically create a root user for you and generate a password, which is stored in/root/. mysql_secret.

Start mysql server. you can use the following commands:

1

> Mysqld-u mysql

2

>/Etc/init. d/mysql start

You need to use root to connect to the database, or use mysqladmin to manage accounts. Then reset your password. And create other users. Each user has multiple login methods, such as remote and localhost. You need to create various login methods and corresponding passwords for your account.

So far, your mysql configuration is complete.

Next, let's talk about my problems. This problem takes me a lot of time.

After completing Step 1, I performed step 2 and found that no matter what account I use, I could not log on to mysql. mysqladmin must also be logged on as root. Therefore, my root is invalid. The password in/root/. mysql_secret exists. This indicates that mysql_install_db encountered a problem during rpm installation, which may be a bug. I uninstalled and reinstalled, and the problem cannot be solved. Therefore, I can only start the Mysql security mode to check whether there are any users in the user table.

Start mysql security mode.

1

Stop mysql:

2

>/Etc/init. d/mysql stop

3

4

Start security mode:

5

> Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &

Connect to mysql. In the above mode, mysql does not check the user password. You can directly run mysql to connect.

View the user table. Run

1

Mysql> use mysql;

2

Mysql> select * from user;

I found that this table does not contain any data. This validates my previous ideas and users are not populate in. What should I do? You can only create one user for it.

Create a root user:

1

Mysql> insert into user VALUES ('localhost', 'root', password ('root '),

2

'Y', 'y ', 'Y', 'y ',

3

'Y', 'y ', 'Y', 'y ',

4

'Y', 'y', ', '0', '0', '0 ', '0', '0', '','', 'n ');

Pay attention to the four values respectively, the three values in the first line, and the last value in the last line. The third line of the first line is the user's method. % represents any host, and ip addresses can also be used. The last value "N" indicates whether your password has expired. if it has expired, you need to reset the password during login.

So far, you have a root account. Disable the security mode, start the normal mode, and log on to mysql as the root user. Next, go back to step 1 of the normal process.

Complete.

BitsCN.com

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.