本文共 5525 字,大约阅读时间需要 18 分钟。
解压软件包,安装cmake
[root@server1 ~]# lscmake-2.8.12.2-4.el6.x86_64.rpm mysql-5.7.17 mysql-boost-5.7.17.tar.gz[root@server1 ~]# yum install -y cmake-2.8.12.2-4.el6.x86_64.rpm 先安装依赖性[root@server1 mysql-5.7.17]# yum install -y gcc gcc-c++
[root@server1 mysql-5.7.17]# yum install ncurses-devel bison -y编译[root@server1 mysql-5.7.17]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql -DMYSQL_DATADIR=/usr/local/lnmp/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_BOOST=/root/mysql-5.7.17/boost/boost_1_59_0/
[root@server1 mysql-5.7.11]# make && make install建用户:[root@server1 mysql-5.7.17]# groupadd -g 27 mysql[root@server1 mysql-5.7.17]# useradd -u 27 -g 27 -M -d /usr/local/lnmp/mysql/ mysql[root@server1 mysql-5.7.17]# id mysqluid=27(mysql) gid=27(mysql) 组=27(mysql)[root@server1 mysql-5.7.17]# usermod -s /sbin/nologin mysql[root@server1 mysql-5.7.17]# cd /usr/local/lnmp/mysql/[root@server1 mysql]# chown mysql.mysql . -R[root@server1 mysql]# ll总用量 56drwxr-xr-x 2 mysql mysql 4096 7月 28 12:12 bin-rw-r--r-- 1 mysql mysql 17987 11月 28 2016 COPYINGdrwxr-xr-x 2 mysql mysql 4096 7月 28 12:11 docsdrwxr-xr-x 3 mysql mysql 4096 7月 28 12:11 includedrwxr-xr-x 4 mysql mysql 4096 7月 28 12:12 libdrwxr-xr-x 4 mysql mysql 4096 7月 28 12:11 mandrwxr-xr-x 10 mysql mysql 4096 7月 28 12:12 mysql-test-rw-r--r-- 1 mysql mysql 2478 11月 28 2016 READMEdrwxr-xr-x 28 mysql mysql 4096 7月 28 12:12 sharedrwxr-xr-x 2 mysql mysql 4096 7月 28 12:12 support-files[root@server1 mysql]# cd [root@server1 ~]# source .bash_profile [root@server1 ~]# chown root . -R[root@server1 ~]# vim /etc/my.cnf [root@server1 ~]# cd -/usr/local/lnmp/mysql[root@server1 mysql]# cd support-files/[root@server1 support-files]# cp mysql.server /etc/init.d/mysqld[root@server1 support-files]# ll /etc/init.d/mysqld -rwxr-xr-x 1 root root 10916 7月 28 13:47 /etc/init.d/mysqld[root@server1 support-files]# cd ..[root@server1 mysql]# mysqld --initialize --user=mysql [root@server1 mysql]# chown mysql data -R[root@server1 mysql]# ll总用量 60drwxr-xr-x 2 mysql mysql 4096 7月 28 12:12 bin-rw-r--r-- 1 mysql mysql 17987 11月 28 2016 COPYINGdrwxr-x--- 5 mysql mysql 4096 7月 28 13:47 datadrwxr-xr-x 2 mysql mysql 4096 7月 28 12:11 docsdrwxr-xr-x 3 mysql mysql 4096 7月 28 12:11 includedrwxr-xr-x 4 mysql mysql 4096 7月 28 12:12 libdrwxr-xr-x 4 mysql mysql 4096 7月 28 12:11 mandrwxr-xr-x 10 mysql mysql 4096 7月 28 12:12 mysql-test-rw-r--r-- 1 mysql mysql 2478 11月 28 2016 READMEdrwxr-xr-x 28 mysql mysql 4096 7月 28 12:12 sharedrwxr-xr-x 2 mysql mysql 4096 7月 28 12:12 support-files[root@server1 mysql]# /etc/init.d/mysqld startStarting MySQL. [确定][root@server1 mysql]# chown root . -R[root@server1 mysql]# chown mysql data -R[root@server1 mysql]# ll总用量 60drwxr-xr-x 2 root mysql 4096 7月 28 12:12 bin-rw-r--r-- 1 root mysql 17987 11月 28 2016 COPYINGdrwxr-x--- 5 mysql mysql 4096 7月 28 13:48 datadrwxr-xr-x 2 root mysql 4096 7月 28 12:11 docsdrwxr-xr-x 3 root mysql 4096 7月 28 12:11 includedrwxr-xr-x 4 root mysql 4096 7月 28 12:12 libdrwxr-xr-x 4 root mysql 4096 7月 28 12:11 mandrwxr-xr-x 10 root mysql 4096 7月 28 12:12 mysql-test-rw-r--r-- 1 root mysql 2478 11月 28 2016 READMEdrwxr-xr-x 28 root mysql 4096 7月 28 12:12 sharedrwxr-xr-x 2 root mysql 4096 7月 28 12:12 support-files[root@server1 mysql]# mysql_secure_installation 初始化密码:前两项为NO,后面yes或回车即可[root@server1 mysql]# mysql_secure_installationSecuring the MySQL server deployment.
Enter password for user root:
The existing password for the user account root has expired. Please set a new password.
New password:
Re-enter new password:
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No: NO
Using existing password for root.Change the password for root ? ((Press y|Y for Yes, any other key for No) : no... skipping.
By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : yes
Success.Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
... skipping.
By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
... skipping.
Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
... skipping.
All done! [root@server1 mysql]# mysql -pmysql> show databases-> ;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sys |+--------------------+4 rows in set (0.00 sec)转载于:https://blog.51cto.com/13810716/2151444