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

Source code installation mysql

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

Share

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

Create a mysql group:

Groupadd mysql

Create mysql users and assign them to this mysq group. No home directory is created and users are not allowed to log in. (login is not allowed because the mysql you just created is a virtual user)

Useradd mysql-g mysql-M-s / bin/nologin

Source code installation mysql

Decompress and compile and install:

. / configure\

-- prefix=/application/mysql5.1.72\

-- with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock\

-- localstatedir=/application/mysql5.1.72/data\

-- enable-assembler\

-- enable-thread-safe-client\

-- with-mysqld-user=mysql\

-- with-big-tables\

-- without-debug\

-- with-pthread\

-- enable-assembler\

-- with-extra-charsets=complex\

-- with-readline\

-- with-ssl\

-- with-embedded-server\

-- enable-local-infile\

-- with-plugins=partition,innobase\

-- with-mysqld-ldflags=-all-static\

-- with-client-ldflags=-all-static

Make & & make make install

Create a soft link to mysql after installation:

Ln-s / application/mysql5.1.72/ / application/apache

View the configuration files of cnf under / usr/local/tools/mysql-5.1.72/support-files/ in this directory. These files are templates for default configuration files and are suitable for different scenarios.

[root@node1 support-files] # ll my*.cnf

-rw-r--r-- 1 root root 4746 05-04 02:49 my-huge.cnf the fourth smallest these are measured by the hardware configuration of the server, the server hardware is too low, with the smallest, the configuration is high, and the maximum

-rw-r--r-- 1 root root 19779 05-04 02:49 my-innodb-heavy-4G.cnf largest

-rw-r--r-- 1 root root 4720 05-04 02:49 my-large.cnf third small

-rw-r--r-- 1 root root 4731 05-04 02:49 my-medium.cnf smallest

-rw-r--r-- 1 root root 2499 05-04 02:49 my-small.cnf second smallest

Then copy the configuration file selected for your server to / etc

[root@node1 support-files] # cp my-small.cnf / etc/my.cnf

Create the directory where the mysql database holds the data:

[root@node1 ~] # mkdir / application/mysql/data-p

Grant permissions to the mysql user and the mysql group to the / application/mysql/ directory

[root@node1] # chown-R mysql.mysql / application/mysql/

Initialize data file

[root@node1] # / application/mysql/bin/mysql_install_db-basedir=/application/mysql/-datadir=/application/mysql/data/-user=mysql

Plication/mysql/data/-user=mysql

Installing MySQL system tables...

170504 4:34:50 [Warning]'--skip-locking' is deprecated and will be removed in a future release. Please use'--skip-external-locking' instead.

OK

Filling help tables...

170504 4:34:50 [Warning]'--skip-locking' is deprecated and will be removed in a future release. Please use'--skip-external-locking' instead.

OK

To start mysqld at boot time you have to copy

Support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!

To do so, start the server, then issue the following commands:

/ application/mysql//bin/mysqladmin-u root password' new-password'

/ application/mysql//bin/mysqladmin-u root-h node1.com password' new-password'

Alternatively you can run:

/ application/mysql//bin/mysql_secure_installation

Which will also give you the option of removing the test

Databases and anonymous user created by default. This is

Strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

Cd / application/mysql/; / application/mysql//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

Cd / application/mysql//mysql-test; perl mysql-test-run.pl

Please report any problems with the / application/mysql//scripts/mysqlbug script!

Now that mysql has been installed, two libraries will be generated if you look in the data directory:

[root@node1 ~] # ll / application/mysql/data/

Total 8

Drwx- 2 mysql root 4096 05-04 04:34 Library of the mysql system

Drwx- 2 mysql root 4096 05-04 04:34 test test library, recommended to delete, not safe.

[root@node1 init.d] # / application/mysql//bin/mysqld_safe &

[1] 17071

[root@node1 init.d] # 170504 04:48:46 mysqld_safe Logging to'/ application/mysql5.1.72/data/node1.com.err'.

170504 04:48:47 mysqld_safe Starting mysqld daemon with databases from / application/mysql5.1.72/data

[root@node1 init.d] #

[root@node1 init.d] #

[root@node1 init.d] #

[root@node1 init.d] #

[root@node1 init.d] #

[root@node1 init.d] # netstat-tulnp | grep 3306

Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 17179/mysqld

Start mysql start in start mode

[root@node1 init.d] # cp / usr/local/tools/mysql-5.1.72/support-files/mysql.server / etc/init.d/mysqld

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

After saving it, you can start it.

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | test |

+-+

3 rows in set (0.00 sec)

Mysql > drop database test

Query OK, 0 rows affected (0.01 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

+-+

2 rows in set (0.00 sec)

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | localhost |

| | root | localhost |

| | node1.com |

| | root | node1.com |

+-+ +

5 rows in set (0.00 sec)

Mysql > drop user "" @ localhost

->

Query OK, 0 rows affected (0.00 sec)

Mysql > drop user "" @ node1.com

->

Query OK, 0 rows affected (0.00 sec)

Mysql >

Mysql >

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | root | localhost |

| | root | node1.com |

+-+ +

3 rows in set (0.00 sec)

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