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

Installation of Mysql database

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

Share

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

System environment: CentOS 6.8 64-bit

Mysql version: mysql-5.6.30

Mysql official website: http://www.mysql.com/

Generally speaking, in a formal production environment, you need to download GA (stable) version. The installation directory is usually / usr/local/mysql, while the source code is generally downloaded to the / usr/local/src directory. The compilation and installation process is as follows:

Uninstall the default installed version:

Yum list | grep 'mysql' confirm whether it is installed by default

Yum-y remove mysql uninstall if installed

Second, install the libraries that Mysql depends on:

Yum-y groupinstall "Development tools" installation development tools

Yum-y install ncurses-devel ncureses provides character terminal processing libraries, such as panels and menus

Third, create Mysql users and Mysql groups: (delete if there was a previous one)

Groupadd-r mysql

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

Download and install the compilation tool Cmake:

Cd / usr/local/src

Wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz

Tar-zxf cmake-3.7.1.tar.gz

Cd cmake-3.7.1

. / bootstrap

Make & & make install

(5) to establish a database directory:

Mkdir-pv / usr/local/data can use a single hard disk or logical volume in a production environment

Chown-R mysql.mysql / usr/local/data database directory Mysql user requires write permission

6. Install Mysql:

Wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.30.tar.gz

Tar-zxf mysql-5.6.30.tar.gz

Cd mysql-5.6.30

Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ specify the installation directory

-DMYSQL_DATADIR=/usr/local/data\ specify the database directory

-DSYSCONFDIR=/etc\ specify the profile directory

-DWITH_INNOBASE_STORAGE_ENGINE=1\ start the database engine

-DWITH_ARCHIVE_STORAGE_ENGINE=1\ start the database engine

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\ start the database engine

-DWITH_SSL=system\ enable ssl library support

-DWITH_ZLIB=system\ supports zlib libraries

-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock\ sock file location

-DDEFAULT_CHARSET=utf8\ default character set

-DDEFAULT_COLLATION=utf8_general_ci default character proofreading

Make & & make install

7 initialization of the database:

Chown-R mysql.mysql / usr/local/mysql

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

Set Mysql as the system service:

Cd / usr/local/mysql/support-files/

Cp my-default.cnf / etc/my.cnf establish configuration file

Cp mysql.server / etc/init.d/mysqld replication startup script

Chkconfig-add mysqld

Chkconfig-level 345 mysqld on

Service mysqld start

9. Set the environment variable of Mysql:

Vim / etc/profile.d/mysql.sh create a new mysql.sh file and add the following path to the file

"export PATH=$PATH:/usr/local/mysql/bin"

. / etc/profile.d/mysql.sh reread the configuration file

Echo "/ usr/local/mysql/lib" > / etc/ld.so.conf.d/mysql.conf ldconfig

At this point, mysql has been installed.

Note: if the following error occurs during startup after installation:

Starting MySQL..The server quit without updating PID file ([FAILED] / mysql/localhost.localdomain.pid).

It may be due to the following reasons:

1 check whether the disk space is full

2 whether the database directory has write permission

3 check whether the port is occupied by netstat-anpt | grep '3306' command; if so, use killall mysqld to kill the process and release the port

4 if there is a problem with the initialization of the database, you can deal with it according to the prompt

Typically, Mysql error logs are files in the database directory with the suffix .err.

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