CentOS Install MySQL

Source: Internet
Author: User

Just got a CentOS in the virtual machine, and then I need a mysql.

Baidu, is to use yum install MySQL official RPM package (previously used Ubuntu, come up incredibly directly with apt I am so stupid haha ha). But I do not use the graphical interface, but also do not bother to get anything like FTP tools. So the simplest way is to wget download the official package.

Because the link is too long, I do not bother to play, so directly with Xshell SSH to the virtual machine, I looked at the port, SSH is open, so directly connected.

After discovering that there is no wget this tool, then the next bar!

Yum Install wget

This time found not installed, reported the following error

Cannot find a valid baseurl for repo:base/7/x86_64

Baidu later found the need to configure the network card configuration file

vi/etc/sysconfig/network-scripts/ifcfg-NIC Name

About the NIC name can be obtained with ifconfig

Change the onboot=no in the config file to Yes

or open vi/etc/resolv.conf, add nameserver 8.8.8.8

Should be the problem of DNS, so can not directly resolve the wget domain, changed the better. Don't forget to restart the network service.

Service Network restart

Complete. Install wget again (you can set up a software source or agent, or the speed is unbearable).

After installation wget can go to the MySQL official website to find Yum Source, here I directly to the right to send up.

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

Foreign software source download is very slow, it is recommended to get a ladder faster, recommended vultr, cheap and fast

VULTR official website

After download, you can install this RPM source with Yum, which can be installed with Yum Localinstall or RPM.

Then install the MySQL software

Yum Install Mysql-community-server

After the MySQL installation is complete, start the MySQL service

Service mysqld Start

Then you try to log in to MySQL is not logged on, because the initial password is random, then need to grep search for a random password.

grep "Password"/var/log/mysqld.log #这个是mysql的日志文件

Find "A temporary password is generated for [email protected]: MO*PPZHB:0SW" This location, which MO*PPZHB:0SW is the default password.

Then use the default password to go in

Mysql-u root-p

Enter Password: #这里把密码敲进去

Successfully entered MySQL, but this initial password is too difficult to remember, we change a simple. Come and come.

Alter user ' root ' @ ' localhost ' identified by ' password '; #mysql5. More than 7.20 seems to have a plugin that does not allow the password too simple to turn off
Flush privileges;

The MySQL installation is now successful!

CentOS Install MySQL

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.