centos7.2 Compile and install mysql5.7.21 error resolution

Source: Internet
Author: User
Tags chmod mkdir

Compile and install MySQL

Installation Environment
Install package
[Email protected] ~]# ls/root/tools/
app.tar.gz mysql-5.7.21 mysql-5.7.21.tar.gz nginx-1.15.0.tar.gz nginx_conf.tar.gz
Operating system
[Email protected] ~]# cat/etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
Memory
[Email protected] ~]# free-m
Total used free shared buff/cache available
mem:7296 456 230 7 6609 6553
swap:4095 1 4094
Disk
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/xvda2 36G 13G 22G 37%/
Devtmpfs 3.8G 0 3.8G 0%/dev
Tmpfs 3.7G 0 3.7G 0%/dev/shm
Tmpfs 3.7G 8.5M 3.7G 1%/run
Tmpfs 3.7G 0 3.7G 0%/sys/fs/cgroup
Tmpfs 730M 0 730M 0%/run/user/0

installation process
Get used to installing services under a unified path
Mkdir/app

Installation dependencies
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel libaio libaio-devel perl-data-dumper net-tools

Add MySQL User
Useradd-m-s/sbin/nologin MySQL

High-version MySQL requires Boots library installation to work properly
Create a folder named Boost under/usr/local
Mkdir-p/usr/local/boost
Go to this newly created folder and download boost
wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
Decompression can
Tar-xvzf boost_1_59_0.tar.gz

Compile parameters
CMake. -dcmake_install_prefix=/app/mysql-5.7.21-dmysql_datadir=/app/mysql-5.7.21/data-dsysconfdir=/etc-dwith_myisam_ storage_engine=1-dwith_innobase_storage_engine=1-dmysql_unix_addr=/var/lib/mysql/mysql.sock-dmysql_tcp_port= 3306-denabled_local_infile=1-dwith_partition_storage_engine=1-dextra_charsets=all-ddefault_charset=utf8- Ddefault_collation=utf8_general_ci-dwith_boost=/usr/local/boost

Make && make install

Initialize MySQL

Cp/root/tools/support-files/mysql.server/etc/init.d/mysqld
Chown–r Mysql.mysql/app/mysql_5.7.21/data
chmod +x/etc/init.d/mysqld
chmod 1777/tmp
Echo ' Export path=/app/mysql-5.7.21/bin: $PATH ' >>/etc/profile
Source/etc/profile
/app/mysql/bin/mysqld--initialize--user=mysql--basedir=/app/mysql-5.7.21--datadir=/app/mysql-5.7.21/data
Note: Initialization completion generates root password, copy, easy login to MySQL reset password

Report warning after initialization is complete
2018-06-17t10:53:58.352241z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details).

Solve:
Add a line under [Mysqld] in the/etc/my.cnf file Explicit_defaults_for_timestamp = True

Start MySQL Start
/etc/init.d/mysqld start

But it was an error,
It's an error.
An error.
[[email protected] support-files]#/etc/init.d/mysqld start
Starting mysql.2018-06-17t11:08:05.949747z Mysqld_safe Error:log-error set to '/var/log/mariadb/mariadb.log ', however File don ' t exists. Create writable for user ' MySQL '.
error! The server quit without updating PID file (/var/lib/mysql/ecs-adfa.novalocal.pid).

Also saw a few netizens article, some said is deleted my.cnf can start, but, production environment needs to add or modify MySQL configuration file, delete must be not feasible, oneself also did not try to be possible no.

Your own solution:
Manually create a log file and authorize it to MySQL
Mkdir-p/var/log/mariadb
Touch/var/log/mariadb/mariadb.log
Chown-r Mysql.mysql/var/log/mariadb/mariadb.log

Start MySQL again, and error (tried several times, the middle of missing some error messages)
MYSQL Server Startup error ' the server quit without updating PID file '

Solve
Modify the path of the DataDir and sock of the default [mysqld] in MY.CNF
Switch
[Mysqld]
Datadir=/app/mysql-5.7.21/data
Socket=/tmp/mysql.sock

Start MySQL again
[[email protected] support-files]#/etc/init.d/mysqld start
Starting MySQL. success!

However, when mysql-uroot-p log in to MySQL, the error
Said to be unable to find sock (error was not recorded at the time)

Solve:
Add path to Sock
Modify/ETC/MY.CNF.D/MYSQL-CLIENTS.CNF
[MySQL]
Socket=/tmp/mysql.sock

At this point, you can log in, remember to change the password after login, even if you do not modify, MySQL will remind you to modify.

First of all, this is probably recorded, later encountered in the revision.

centos7.2 Compile and install mysql5.7.21 error resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.