如何在CentOS7中安装Mysql

How To Install MySQL (CentOS 7)
Share This Article [TheChamp-Sharing]
An open source variation of the SQL database management system, MySQL is a very common system to find on a Linux based server. MySQL is used by a number of large companies across the internet such as Facebook and YouTube to store various bits of pertinent data. MySQL can also be used in tandem with content management applications such as WordPress or Joomla to develop and display a fantastic looking website. The focus of this article is to answer that question and help you get MySQL installed on a server running CentOS 7.

How To Install MySQL (CentOS 7)

Before we get started there are two things that we need to cover.

You’ll need to have access to your server and you’ll need to login via SSH. If you’re not certain how to access your server using SSH, please refer to the following article: Connecting to Your Server via SSH.
CentOS 7 by default uses MariaDB, which is a fork of MySQL designed and managed by MySQL’s original developers. MariaDB was designed as a replacement for MySQL and in most instances will work flawlessly in place of MySQL.

This is an important distinction so that you understand that unless your application or your specific situation requires that you use MySQL explicitly, you do not have to and you should be able to utilize MariaDB. If you’d like to install MariaDB, please checkout: How to install MariaDB (CentOS 7). Now without further ado, let’s proceed with our MySQL installation!

First, add the MySQL community Yum Repository

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
Then, install MySQL by using the newly installed Yum repositories

yum install mysql-server
If you completed both steps successfully without any errors, congratulations MySQL is now installed! You can start MySQL and make sure it stays started by checking its status using the following commands:

systemctl start mysqld
systemctl status mysqld
With MySQL now installed and started, you should run the MySQL security script that was installed with MySQL. This will allow you to change the default root password that was set during installation to a more secure password. Please note that you’ll need the default root MySQL password that was set during the installation, which you can get by using the following command:

cat /var/log/mysqld.log | grep ‘temporary password’
Copy or make note of the default password, and execute this next:

mysql_secure_installation
Once you enter the default root MySQL password you’ll be asked to change this password to something more secure. Follow the on screen instructions to change your password and complete the installation.

Posted in CentOSTagged install mysql

以上源自https://www.hostwinds.com/guide/install-mysql-centos-7/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值