Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql5.6.42-- compilation and installation

Shulou Source: shulou.com Published: 2022-06-01 12:21:50 11月17日 Update

I. installation environment

Centos6.5 64 bit

Preparation before compilation and installation

Uninstall the old version:

# rpm-qa | grep-I mysql

# rpm-ev-nodeps mysql-libs-5.1.73-8.el6_8.x86_64

Install the dependency package:

Yum install cmake bison bison-devel libaio libaio-devel ncurses ncurses-devel-y

Download and extract the installation package # cd / opt#wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.42.tar.gz#tar xf mysql-5.6.42.tar.gz

IV. Compilation and installation

# cd mysql-5.6.42

# cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ # installation directory

-DMYSQL_DATADIR=/usr/local/mysql/data\ # Database storage directory

-DDEFAULT_CHARSET=utf8\ # use utf8 characters

-DDEFAULT_COLLATION=utf8_general_ci\ # check character

-DEXTRA_CHARSETS=all\ # install all extended character sets

-DENABLED_LOCAL_INFILE=1\ # allow data to be imported locally

Note: if there is an error indicating the dependency during the cmake process, after installing the dependency package, you need to delete the CMakeCache.txt file in the current directory, and then in cmake, otherwise the error will be reported.

Until there is no error from error, you can do the following:

# make

# make install

Initialize the database

1. Create mysql users and groups

# groupadd mysql

# useradd-r-s / sbin/nologin-g mysql mysql

2. Set permissions

# chown-R mysql.mysql / usr/local/mysql/

3. Create a configuration file

# cp support-files/my-default.cnf / etc/my.cnf

4. Initialize the database

# cd / opt/mysql-5.6.42/scripts

# chmod + x mysql_install_db

#. / mysql_install_db-user=mysql-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data/

5. Generate startup script

# cd / opt/mysql-5.6.42/support-files

# cp mysql.server / etc/init.d/mysqld

# chmod + x / etc/init.d/mysqld

6. Join the system service and set self-boot.

# chkconfig-add mysqld

# chkconfig mysqld on

7. Start the service

# service mysqld start or / etc/init.d/mysqld start

8. Add mysql to the environment variable

# vim / root/.bash_profile

# source / root/.bash_profile

9. Load mysql library files

# vim / etc/ld.so.conf add: / usr/local/mysql/lib

# ldconfig

10. Local login test

Tags: Data characters databases directories compilers files environments services variables character sets library files permissions versions users systems scripts procedures facets reports preparations Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi Shulou Technology NVidia Huawei