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

Step-by-step tutorial for installing MySQL on linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "the step tutorial of installing MySQL on linux". In the daily operation, I believe that many people have doubts about the step tutorial of installing MySQL on linux. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubts of "step tutorial of installing MySQL on linux". Next, please follow the editor to study!

Install Mysql on Linux/UNIX

It is recommended to use the RPM package for installation on the Linux platform. Mysql,MySQL AB provides the download address for the following RPM packages:

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

MySQL-client-MySQL client program that connects to and operates the Mysql server.

MySQL-devel-Library and include files, which you need to install if you want to compile other MySQL clients, such as Perl modules.

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

MySQL-bench-A benchmark and performance testing tool for the MySQL database server.

Next, we use the yum command to install MySql under the CentOS system:

Check whether the system comes with the installation mysql:

Rpm-qa | grep mysql

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

Rpm-e mysql / / normal delete mode rpm-e-- nodeps mysql / / forcefully delete mode. If you use the above command to delete other dependent files, you can use this command to delete them.

Install mysql:

Yum install mysqlyum install mysql-serveryum install mysql-devel

Start mysql:

Service mysqld start

Note: if this is the first time we start the mysql service, the mysql server will first initialize the configuration.

If it is the CentOS 7 version, because the MySQL database has been removed from the default program list, you can use mariadb instead:

Yum install mariadb-server mariadb

The relevant commands for the mariadb database are:

Systemctl start mariadb # start MariaDBsystemctl stop mariadb # stop MariaDBsystemctl restart mariadb # restart MariaDBsystemctl enable mariadb # set boot to verify Mysql installation

After successfully installing Mysql, some of the underlying tables will be initialized, and after the server starts, you can verify that Mysql is working properly through a simple test.

Use the mysqladmin tool to get the server status:

Use the mysqladmin command to check the version of the server, which is located at / usr/bin on linux on linux and C:\ mysql\ bin on window.

[root@host] # mysqladmin-- version

This command on linux will output the following result, which is based on your system information:

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

If you do not enter any information after the above command is executed, your Mysql is not installed successfully.

Use MySQL Client (Mysql client) to execute simple SQL commands

You can use the mysql command in MySQL Client (Mysql client) to connect to the Mysql server. By default, the password of the Mysql server is empty, so there is no need to enter a password for this example.

The command is as follows:

[root@host] # mysql

The mysql > prompt will be output after the above command is executed, which indicates that you have successfully connected to the Mysql server. You can execute the SQL command at the mysql > prompt:

Mysql > SHOW DATABASES;+-+ | Database | +-+ | mysql | | test | +-+ 2 rows in set (0.13 sec) what you need to do after installation of Mysql

After Mysql is installed successfully, the default root user password is empty. You can use the following command to create a root user password:

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

Now you can connect to the Mysql server with the following command:

[root@host] # mysql-u root-pEnter password:*

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

At this point, the study of the "step-by-step tutorial for installing MySQL on linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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