How to install and configure Mysql5.7.12/10
This article mainly introduces how to achieve the installation and configuration of Mysql5.7.12/10, the content of the article is carefully selected and edited by the author, with a certain pertinence, for your reference significance is still relatively great, the following with the author to understand how to achieve Mysql5.7.12/10 installation and configuration bar.
1. Install the packages needed to compile the code
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel libaio libaio-develperl-Data-Dumper net-tools
2. Installed version of boost1.53:
Yum-y install boost boost-devel boost-doc
3. Download the release version of boost1.59
Cd / usr/local/src
Wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
4. Decompress and install boost1.59
Tar zxvfboost_1_59_0.tar.gz
Cd boost_1_59_0
. / bootstrap.sh--with-libraries=system,filesystem,log,thread-- with-toolset=gcc
. / b2toolset=gcc
. / b2install
Installed by default in the / usr/local/lib directory; header files in the / usr/local/include/boost directory
The version of boost must be 1.59, if not, uninstall and reinstall (5.7.10 can also be used)
5. Install mysql5.7.12
Wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12.tar.gz
You can pass it on yourself.
Check whether the MD5 value is the same as the official website
Md5sum mysql-5.7.12.tar.gz
1) decompression
Tar xvfmysql-5.7.12.tar.gz
Cd mysql-5.7.12
2) compile and install
Cmake\
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\
-DMYSQL_DATADIR=/usr/local/mysql/data\
-DSYSCONFDIR=/etc\
-DWITH_MYISAM_STORAGE_ENGINE=1\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_MEMORY_STORAGE_ENGINE=1\
-DWITH_READLINE=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
(--Build fileshave been written to: / root/mysql-5.7.10
The last sentence of compilation shows that this is ok.)
Make&& make install
6. Check whether there are any mysql users
Cat / etc/passwd | grep mysql
7. View the list of user groups
Cat / etc/group
Create if you don't
Groupadd mysql
Useradd-g mysql mysql
8. Set permissions and initialize the MySQL system authorization table
Modify / usr/local/mysql permissions
Chown-Rmysql:mysql / usr/local/mysql
9. Enter the installation path:
Cd / usr/local/mysql
Sudo is a must! (version 6.4 or above) otherwise the database cannot be started
Sudo cp support-files/my-default.cnf / etc/my.cnf
Vi / etc/my.cnf
[mysqld]
Datadir=/var/lib/mysql
Socket=/var/liv/mysql/mysql.sock
Symbolic-links=0
Log-bin=mysql-bin
Server-id=151
Sql-mode= ""
10. Add service scripts to init.d
Cp support-files/mysql.server / etc/init.d/mysqld
Add execution permissions:
Chmod 755/etc/init.d/mysqld
11. Default database initialization
Bin/mysql_install_db-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data-user=mysql
Boot self-start
Chkconfig-list mysql
Chkconfig-add mysql
Set mysql to start automatically at level 345
Chkconfig-level 345 mysql on
Error
Startup was not successful
Kill the blocking process
Start successfully!
12. Change the root password
Shut down the database
Service mysqld stop
Add skip-grant-tables to / etc/my.cnf
Start the database
Mysql-p can be logged in directly, and enter with password is fine.
If you report an error,
Execute the following statement
Ln-s / usr/local/mysql/bin/mysql / usr/bin
Take a closer look at the red mark below and then do it.
Update mysql.user setpassword=password ('newpassword') where user='root'
The lower version of centos is password=password (newpassword), but my system is centos7.2. I ran an error and found that password changed the field after Google search.
Update mysql.user set authentication_string=password ('WrAJ2wag:gx') where user='root'
Exit the database and restart the database
Set the skip- in / etc/my.cnf. Annotation
Try logging in to the database:
Success!
After reading the above about how to install and configure Mysql5.7.12/10, many readers must have some understanding. If you need more industry knowledge and information, you can continue to follow our industry information column.