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 in Linux system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge of this article "how to install MySQL in the Linux system", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to install MySQL in the Linux system" article.

About MySQL: MySQL is a small relational database management system developed, released and supported by MySQL AB.

MySQL is a fast, multi-threaded, multi-user and robust SQL database server. The MySQL server supports the use of mission-critical, heavy-duty production systems, or it can be embedded in a large configuration (mass- deployed) software.

The characteristics of MySQL are:

Collection-oriented operation mode of ①

② open source code

③ is highly non-procedural.

④ provides multiple uses in a single grammatical structure

⑤ language is concise, easy to use and easy to learn.

The method of installing MySQL in Linux system: decompress tar-xvf mysql-5.7.26-linux-glibc2.12-x86_64.tar

Move and rename again.

Mv mysql-5.7.26-linux-glibc2.12-x86_64 / usr/local/mysql

Create mysql user groups and users and modify permissions groupadd mysql useradd-r-g mysql mysql create data directories and grant permissions

Mkdir-p / data/mysql # create directory chown mysql:mysql-R / data/mysql # Grant permissions

Configure my.cnf

The vim / etc/my.cnf content is as follows

[mysqld] bind-address=0.0.0.0 port=3306 user=mysql basedir=/usr/local/mysql datadir=/data/mysql socket=/tmp/mysql.sock log-error=/data/mysql/mysql.err pid-file=/data/mysql/mysql.pid # character config character_set_server=utf8mb4 symbolic-links=0 explicit_defaults_for_timestamp=true

Initialize the database into the bin directory of mysql

Cd / usr/local/mysql/bin/ initialization

. / mysqld-- defaults-file=/etc/my.cnf-- basedir=/usr/local/mysql/-- datadir=/data/mysql/-- user=mysql-- initialize view password

Cat / data/mysql/mysql.err

Start mysql and change the root password to put mysql.server in / etc/init.d/mysql first

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysql start!

Service mysql start ps-ef | grep mysql

It means that mysql has been installed successfully!

Let's change the password

First log in to mysql, and the previous one is randomly generated.

. / mysql-u root-p # bin directory

Perform the following three steps, and then log in again.

SET PASSWORD = PASSWORD ('123456'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; FLUSH PRIVILEGES

If you use a remote connection at this time... You will find that you cannot connect.

The following three commands are mainly executed here (log in to the database first)

Use mysql # accesses the mysql library update user set host ='% 'where user =' root'; # so that root can access FLUSH PRIVILEGES; # refresh from any host

If you do not want to use the mysql command in the bin directory every time, execute the following command

Ln-s / usr/local/mysql/bin/mysql / usr/bin above is about the content of this article about "how to install MySQL in Linux system". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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

Development

Wechat

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

12
Report