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

Mysql installation configuration

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

Share

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

Several common installation packages for mysql: rpm, source code, binary compiler-free

Step (binary compilation-free):

one

Cd / usr/local/src

Go to the / usr/local/src directory

two

Wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

Download binary uncompiled source code package

three

Tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

Decompress the source package

four

Mv mysql-5.6.36-linux-glibc2.5-x86_64 / usr/local/mysql

Move the extracted source package to the / usr/local/mysql directory

five

Cd / usr/local/mysql

Enter the / usr/local/mysql directory

six

Useradd mysql

Establish a mysql user because this user is required to start mysql

seven

Mkdir / data/mysql

Create a datadir, and the database files will be put here

Chown-R mysql:mysql / data/mysql

Change permissions

eight

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

After the command is executed, execute echo $? If the returned result is 0 (or two ok), the installation is successful

If you report an error, install some software packages according to the error prompt

First installation prompt

Perl: warning: Falling back to the standard locale (C). FATAL ERROR: please install the following Perl modules before executing. / scripts/mysql_instal_db:Data::Dumper

Find this package and install it using yum

[root@localhost mysql] # yum list | grep perl | grep-i dumperFailed to set locale, defaulting to Cperl-Data-Dumper.x86_64 2.145-3.el7 base perl-XML-Dumper.noarch 0.81-17.el7 base [root@localhost mysql] # yum install-y perl-Data-Dumper.x86_64

nine

Cp support-files/my-default.cnf / etc/my.cnf

The configuration file for mysql is my.cnf

ten

Cp support-files/mysql.server / etc/init.d/mysqld

Mysql startup script file

eleven

Vi / etc/init.d/mysqld

Define basedir and datadir

Basedir specifies the program directory of mysql

Datadir specifies the place to store the data

twelve

/ etc/init.d/mysqld start (stop)

Start mysql

Or you can use service mysqld start (stop)

If you do not have a startup script, you can use the command line approach

/ usr/local/mysql/bin/mysqld_safe-defaults-file=/etc/my.cnf-user=mysql-datadir=/data/mysql &

-defaults-file specifies the path where the configuration file is located

-user specified user

Datadir specifies the data directory of mysql

If you use the command line to start and shut down the mysql service, using killall mysqld,killall will kill the process after the data is read and written.

If the process of mysqld can not be killed all the time, and ps still has processes, it means that a large amount of data is being slowly written to disk. Do not force kill-9 to kill it, otherwise it may lose data or damage the table.

⑬ adds the startup script to the system service item, sets boot and starts mysql

Chkconfig-add mysqld

/ / add mysql services to the list of system services

Chkconfig mysqld on

/ / turn it on.

If mysql fails to start, check the error log in the / data/mysql directory, which is usually the hostname .err. The command to check whether mysql is started is

Ps aux | grep mysql

/ / the result should be greater than two lines

Netstat-lnp | grep 3306

/ / check to see if port 3306 is listening

Chkconfig mysqld on

/ / turn it on.

If mysql fails to start, check the error log in the / data/mysql directory, which is usually the hostname .err. The command to check whether mysql is started is

Ps aux | grep mysql

/ / the result should be greater than two lines

Netstat-lnp | grep 3306

/ / check to see if port 3306 is listening

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