Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS7 install MySQL5.6

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

= = preparation = =

Step 1, first, create a virtual machine

Step 2, install CentOS

Step 3, configure IP

Step 4, next, install mysql with yum

Https://dev.mysql.com/downloads/repo/yum/

Step 5, install the yum source

Step 6, change the default installation version to 5.6

Step 7, uninstall the mariadb that comes with CentOS7

Rpm-qa | grep mariadb

Rpm-e-- nodeps file name

Step 8, create a mysql user and a mysql user group, and then add the mysql user to the mysql user group

Groupadd mysql

Useradd-g mysql mysql

Step 9, next, you are ready to install

After the installation is complete, you can add an extra my.cnf file under / etc, as shown below

As you can see, the data file is in / var/lib/mysql

Start mysql

Service mysql start | stop | status | restart

Or

Systemctl start | stop | status | restart mysqld

The default mysql boot starts automatically. I don't want it to boot automatically, so cancel the boot and start automatically.

By default, root users do not need a password to log in to the local mysql, so enter mysql and enter directly.

Why is that? Just look at the user table in the mysql database.

The default encoding format is utf-8

You can also set a password for root users.

In the process of setting the password, somehow, the permission of the root user to log in in localhost was lost, resulting in logging in and only seeing the information_schema database.

Then all kinds of Baidu finally get how to reset the root password. The general approach is to stop mysql first, then skip permissions when starting, and then go in and modify it.

Service mysql stop

Mysqld_safe-- skip-grant-tables &

However, there is no record of Host=localhost and User=root in my user table, even if you change the password of all root users to 123456 and type mysql directly into the command line.

Signal, witty, I found that I should use localhost to enter mysql directly, so I specified the host address as 127.0.0.1 to change it.

Perfect solution!

Now there is another problem: only the local computer can access it, and the remote computer cannot access the mysql.

Therefore, the authorized remote can access the mysql using root

Unfortunately, the outside world is still inaccessible.

I found that ping 192.168.10.128 is workable, but telnet 192.168.10.128 3306 is not. I suspected it was the firewall, so I turned off the firewall and tried again.

But turning off the firewall is always not a way, so modify the firewall and add port 3306

It's fine now.

Referenc

Https://dev.mysql.com/downloads/mysql/

Http://blog.csdn.net/a9529lty/article/details/14519471

Https://stackoverflow.com/questions/9382219/error-1045-28000-access-denied-for-user-rootlocalhost-using-password-ye

Http://www.sojson.com/blog/197.html

Http://blog.csdn.net/xlgen157387/article/details/52672988

Https://www.cnblogs.com/moxiaoan/p/5683743.html

Http://blog.csdn.net/gebitan505/article/details/51726649

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report