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

How to install MySQL on yum on Linux or UNIX

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail how to install MySQL on Linux or UNIX. The quality of the article is high, so Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article.

yum install MySQL on Linux/UNIX

RPM packages are recommended for installing Mysql on Linux. MySQL AB provides download addresses for the following RPM packages:

MySQL- MySQL server. You need this option unless you only want to connect to MySQL servers running on another machine.

MySQL client- MySQL client program used to connect to and operate MySQL servers.

MySQL-devel-library and include files, if you want to compile other MySQL clients, such as Perl modules, you need to install this RPM package.

MySQL-shared-This package contains shared libraries (libmysqlclient.so*) that some languages and applications need to load dynamically, using MySQL.

MySQL-bench-Benchmarking and performance testing tool for MySQL database servers.

Before installation, we can check whether the system comes with MySQL:

rpm -qa | grep mysql

If your system is installed, you can choose to uninstall:

rpm -e mysql //normal delete mode rpm -e --nodeps mysql //strong delete mode, if you use the above command to delete, prompt that there are other files that depend on it, then use this command to forcibly delete it. Install official version

Next we use yum command to install MySQL under Centos7 system. It should be noted that MySQL database in CentOS 7 version has been removed from the default program list, so before installation we need to download Yum resource package from official website. Download address: dev.mysql.com/downloads/repo/yum/

Note: During installation, we need to open administrator privileges to install, otherwise it will not be installed due to insufficient permissions. wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpmyum updateyum install mysql-server

Permission settings:

chown mysql:mysql -R /var/lib/mysql

Initialize MySQL:

mysqld --initialize

Start MySQL:

systemctl start mysqld

Check MySQL status:

systemctl status mysqld

Note: If we are starting the mysql service for the first time, the mysql server will be configured initially.

Install Community Edition

In addition, you can also use MariaDB instead, MariaDB database management system is a branch of MySQL, mainly maintained by the open source community, under the GPL license. One of the reasons for this fork was that Oracle acquired MySQL and there was a potential risk of closing MySQL, so the community branched out to avoid that risk.

MariaDB is designed to be fully compatible with MySQL, both API and command line, making it an easy replacement for MySQL. yum install mariadb\-server mariadb

The commands associated with the mariadb database are:

systemctl start mariadb #start MariaDB systemctl stop mariadb #stop MariaDB systemctl restart mariadb #restart MariaDB systemctl enable mariadb #setup boot startup verify MySQL installation

After MySQL is successfully installed, some basic tables will be initialized, and after the server is started, you can verify that MySQL is working properly through simple tests.

Use the mysqladmin tool to get server status:

Use the mysqladmin command to check the server version, which is located in the/usr/bin directory on Linux and C:\mysql\bin on Windows.

[root@host]# mysqladmin --version

On linux this command will output the following result, based on your system information:

mysqladmin Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386

If the above command does not output any information, it means that your Mysql installation was not successful.

After MySQL is installed successfully, the default root password is empty. You can create the root password by using the following command:

[root@host]# mysqladmin -u root password "new_password";

You can now connect to Mysql Server by issuing the following command:

[root@host]# mysql -u root -p *******

Note: When entering the password, the password will not be displayed, you can enter it correctly.

About Linux or UNIX yum how to install MySQL to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

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

Servers

Wechat

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

12
Report