Source installation mysql-5.7.13 a week of Long way summary. It's full of tears.

Source: Internet
Author: User
Tags openssl tar unzip

MySQL has been installed with CMake since 5.5.

5.7.5 starting the installation environment requires boost library support

To download the installation package:

Https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.13.tar.gz

Https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

Tar unzip the installation package.

Required compilation environment: Make GCC gcc-c++ ncurses-devel OpenSSL openssl-devel bison*

PS: Compilation environment must be filled, was the pit of two weeks to realize the lessons of the blood.

Be sure to check to see if there is a MySQL RPM package installed before you install it. If you have one, uninstall it first. Some systems will also unload with MARIADB recommendations.

Compile:

CMake. -dcmake_prefix=/usr/local/mysql \

-dmysql_datadir=/data/mydata \

-DSYSCONFDIR=/ETC \

-dwith_innobase_storage_engine=1 \

-dwith_archive_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwith_readline=1 \

-dwith_libwrap=0 \

-dmysql_unix_addr=/tmp/mysql.sock \

-dwith_ssl=system \

-dwith_zlib=system \

-DWITH_BOOST=/DOCUMENT/TAR/BOOST_1_59_0 \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci

PS: The sense parameter is more difficult to write in the command line, can be written as a script. Problems, stick to Baidu to find it. It's basically a matter of compiling the environment. It's OK to pack anything directly.

As long as the above is not a problem, you can follow make; The make install routine is gone. This step is slower, depending on the performance of the machine.

Installation is complete.

Create a MySQL user

Useradd MySQL

Change the installation directory for MySQL to the owner and the group as MySQL.

Chown-r Mysql:mysql/usr/local/mysql

Create the Mysql-files directory in the MySQL directory

mkdir Mysql-files

PS: This directory is not available by default. See others created I have also created. I don't know what to do with it.

Then the initialization directory

./bin/mysqld--initialize--user=mysql

At the end of the first initialization there will be a string of similar garbled items. That's a temporary password. (However, there are no eggs to use.) Because you might not start it at all.)

PS: Initialization can only be done once by default. If you continue with initialization. The data directory in the configuration file my.cnf needs to be emptied. Similarly, if you want to change the data store directory. You also want to reinitialize the initialization.

Configuration file Resolution:

[Mysqld]

Datadir=/data/mydata #数据目录

Socket=/var/lib/mysql/mysql.sock

# Disabling Symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

Skip-grant-tables #这个是默认没有的, skip password login.

# Settings user and group was ignored when Systemd was used.

# If you need to run mysqld under a different user or group,

# Customize your systemd unit file for mariadb according to the

# instructions in HTTP://FEDORAPROJECT.ORG/WIKI/SYSTEMD

[Mysqld_safe]

Log-error=/var/log/mysql/error.log #错误日志文件

Pid-file=/var/run/mysql/mysql.pid #进程PID

#

# include all files from the Config directory

#

!includedir/etc/my.cnf.d

Start MySQL

./support-files/mysql.server Start

PS: If you can start up, you can only say that you have luck against the sky

If it doesn't start, see my.cnf.

If it is:

[Mysqld_safe]

Log-error=/var/log/mariadb/error.log

Pid-file=/var/run/mariadb/mariadb.pid

Change mariadb to MySQL. Then see if there are both paths, and if not, create both directories. Create only directories, not create files.

Note that the genus and genera are mainly MySQL.

and then restart.

If the temporary password is forgotten or the temporary password is not logged in. Change Password:./bin/mysqladmin-u root Password "root" #注意路径问题.

If you log in or change the password times wrong:

[Email protected] mysql]#./bin/mysql-uroot-p

Enter Password:

ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

PS: The problem was wrapped around the day. The solution is to find the Mysql.sock file in the root directory with find. Then make a soft link to the error path.

[Email protected] mysql]# Find/-name Mysql.sock

Find: '/RUN/USER/1001/GVFS ': Insufficient authority

/var/lib/mysql/mysql.sock

[Email protected] mysql]# ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock

Depending on the path found by the individual to make changes, the specific principles refer to the following links. Very detailed.

https://www.cnblogs.com/Lam7/p/6090975.html PS: Thanks

Then restart the service. You can log in by skipping the password first.

MY.CNF configuration file Add: Skip-grant-tables

Change Password After login:

Update Mysql.user Set Authentication_string=password ("root") where user;

PS: The whole process to find the information for a week, I hope this article can let you less go to the road of injustice.

Source installation mysql-5.7.13 a week of Long way summary. It's full of tears.

Related Article

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.