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

Source: Internet
Author: User

The solution to installation failure of MySQL5.6 management account in linux is nothing, 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. To put it simply, the normal MySQL rpm package installation process is as follows: redhat usually comes with a mysql, first uninstall it, otherwise the installation will conflict. If yum exists, run 1> yum list mysql-client2> yum list mysql-server to find the installed mysql. Run 1> yum remove package-name to delete the mysql package. If no yum exists, you can use 1> rpm-qal | grep mysql to List Installed RPMs and 1> rpm-e package-name to delete them. Run Command 1> whereis mysql to check whether there are any mysql directories. Run 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 and run the following commands: 1> mysqld-u mysql2>/etc/init. d/mysql start needs 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 stop3 4 start safe 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 no data in this table. 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 ', 3 'y', 'y ', 'y', 4'y', 'y ','','', '','', '0', '0', '0', '0', '0', '', 'n'). Pay attention to four values respectively, 3 In the first row and the last value in the last row. 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.

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.