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

Binary package installs mysql database

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

Share

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

Common installation methods of mysql Database

(1) compilation and installation of source code package

Advantages: personalized customized installation

Disadvantages: novice parameter configuration is difficult, compilation environment is dependent, and the steps are more complex.

(2) RPM package installation

Advantages: easy to install

Disadvantages: the built-in version of the system is relatively stable, while the version is relatively old, so it is difficult to achieve custom installation like the source package.

(3) binary package installation

Advantages: simple and fast, no need to install

(4) Enterprises customize RPM packages and RPM packages according to their own needs.

This article will introduce the installation of binary packages and some simple optimizations in it.

Software package:

Mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz

Download address:

Http://downloads.mysql.com/archives/community/

Screenshot of download method:

You can download it with wget, or you can download it and upload it to the server with ftp and other tools. The command in Secure CRT used here can be uploaded using yum install-y lrzsz to install rz and upload sz.

Installation steps:

(1) decompress the uploaded mysql installation package

Tar-xzvf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz will generate an unzipped directory containing the mysql installation files.

(2) create a soft connection to the changed directory. The directory with a version is long and complex. Most people rename it, but renaming is not the best way. Create a soft connection here.

(3) create a user group

Groupradd mysql

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

Parameter description:

-s / sbin/nologin does not allow this user to log in

-g define user group as mysql group

-M does not specify the user's home directory

The above command can be used as an agent with the following command

Useradd-s / sbin/nologin-M mysql

After creation, check the id and / etc/passwd files of mysql to see the relevant information.

Id mysql

(5) initialize the configuration file

There are samples of various configuration files for my.cnf under support-files, where you can copy the default configuration files to the / etc directory

(6) initialize database files

Under the installation directory, create the data directory data for mysql

Authorize mysql users to manage applacation directories

Chown-R mysql.mysql / application/mysql directory

Initialization

. / scripts/mysql_install_db-- basedir=/applacation/mysql-- datadir=/applacation/mysql/data/-- user=mysql

After initialization, notice that the two OK are successful, and a warning message will appear due to reasons such as hostname, but it will not affect its operation.

Use the tree / applaction/mysql/data directory to see the database file

(7) Startup script and changes to startup script

In the support-files directory, there is a mysql.server file that we copy to the / etc/init.d/mysql file, with execute permission.

Note: the default installation path for binary is / usr/local directory, and the path in the startup script should be changed, otherwise an error will be reported because the relevant files cannot be found.

Sed-iaccounspromotionUSERGUR localUniverse mysqlUnipletApplicationUniplicationUniplicationUniplicationUniplicationUniverse / applacation/mysql/bin/mysqld_safe / etc/init.d/mysql

(8) start the database

/ etc/init.d/mysql restart

Check to see if it starts

Netstat-nltup | grep mysql

Check mysql's error log path / applacation/mysql/data log name hostname .erro when an exception occurs

(9) set boot self-startup

You can add it by command, or you can put / etc/init.d/mysql start in / etc/rc.local.

(10) setting of environment variables

Add a path to the / etc/profile file

Echo 'export PATH=/applaction/mysql/bin:$PATH' > > / etc/profile

Make the profile effective

(11) Log in to mysql database test

(12) optimize the deletion of the test library and some unrelated users

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