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

Detailed tutorials for installing MySQL databases

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

I do not know if you have any knowledge of the articles similar to the detailed tutorials of installing MySQL database before, but I will give you a brief introduction here today. If you are interested, let's take a look at the body. I'm sure you'll get something after reading the detailed tutorial on installing MySQL database.

1) create a mysql user account

[root@onde ~] # groupadd mysql

[root@onde] # useradd-s / sbin/nologin-g mysql-M mysql

Check the mysql users and groups you just created.

[root@onde] # tail-1 / etc/passwd

Mysql:x:1001:1001::/home/mysql:/sbin/nologin

You can see that the mysql users and groups have been created successfully.

Now create a fixed directory for all the software, and the command is as follows:

[root@onde] # mkdir-p / home/cheac/tools

[root@onde ~] # cd / home/cheac/tools

2) obtain mysql software package

Link: http://pan.baidu.com/s/1pLNmZB9 password: qkzu

[root@onde ~] # tar xf mysql-5.5.49.tar.gz

[root@onde] # mkdir-p / application/

[root@onde ~] # tar xf mysql-5.5.49.tar.gz

[root@onde ~] # mv mysql-5.5.49 / application/mysql-5.5.49 (move and rename)

Create a soft connection, generate an access path without the version number, and view it.

[root@onde tools] # ln-s / application/mysql-5.5.49/ / application/mysql

[root@onde tools] # ls-l / application/

Next, initialize the mysql configuration file my.cnf

[root@www tools] # cd / application/mysql/

[root@www mysql] # ls-l support-files/*.cnf

-rw-r--r-- 1 7161 wheel 4691 Jun 19 2013 support-files/my-huge.cnf

-rw-r--r-- 1 7161 wheel 19759 Jun 19 2013 support-files/my-innodb-heavy-4G.cnf

-rw-r--r-- 1 7161 wheel 4665 Jun 19 2013 support-files/my-large.cnf

-rw-r--r-- 1 7161 wheel 4676 Jun 19 2013 support-files/my-medium.cnf

-rw-r--r-- 1 7161 wheel 2840 Jun 19 2013 support-files/my-small.cnf

[root@www mysql] # / bin/cp support-files/my-small.cnf / etc/my.cnf

Initialize the MySQL database file with the following command:

[root@www mysql] # mkdir-p / application/mysql/data (create MySQL data file directory)

[root@www mysql] # chown-R mysql.mysql / application/mysql/ (authorizes mysql users to manage the MySQL directory)

[root@www mysql] # / application/mysql/scripts/mysql_install_db-- basedir=/application/mysql-- datadir=/application/mysql/data-- user=mysql (initialize the MySQL database file, there will be a lot of information mentioned, ERROR-level error, there will be two OK, indicating successful initialization, otherwise the initialization problem will be solved)

The main purpose of the above command is to generate the following database files:

[root@www mysql] # tree / application/mysql/data/

/ application/mysql/data/

|-- mysql

| |-- columns_priv.MYD |

| |-- columns_priv.MYI |

| |-- columns_priv.frm |

| |-- db.MYD |

| |-- db.MYI |

| |-- db.frm |

| |-- event.MYD |

| |-- event.MYI |

| |-- event.frm |

... Omit some.

Configure and start the script with the following command:

[root@www mysql] # cp support-files/mysql.server / etc/init.d/mysqld

[root@www mysql] # chmod + x / etc/init.d/mysqld

The default installation path for MySQL binary is / usr/local/mysql, and the path to / usr/local/mysql in the startup script needs to be replaced. The command is as follows:

[root@www mysql] # sed-I's engine engine usr _ dictionary _ localmax _ mysql _ engine

/ application/mysql/bin/mysqld_safe / etc/init.d/mysqld

Start the MySQL database with the following command:

[root@www mysql] # / etc/init.d/mysqld start

Starting MySQL.. SUCCESS!

Check if the MySQL database is started, with the following command:

[root@www mysql] # netstat-lntup | grep mysql

Tcp 0 0.0.0.0 3306 0.0.0.0 * LISTEN 9874/mysqld

If port 3306 is not up, please tail-100/application/mysql/data/ the machine name .err to check the log information to see if there is an error message, and then debug according to the relevant error prompt

All right, MySQL is installed here!

What do you think of this article after reading the detailed tutorial on installing MySQL database? If you want to know more about it, you can continue to follow our industry information section.

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