码迷,mamicode.com
首页 > 数据库 > 详细

mysql 源码安装

时间:2018-07-28 15:11:23      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:rem   bdd   win   add   access   pad   ring   secure   yum   

解压软件包,安装cmake
[root@server1 ~]# ls
cmake-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 mysql
uid=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
总用量 56
drwxr-xr-x 2 mysql mysql 4096 7月 28 12:12 bin
-rw-r--r-- 1 mysql mysql 17987 11月 28 2016 COPYING
drwxr-xr-x 2 mysql mysql 4096 7月 28 12:11 docs
drwxr-xr-x 3 mysql mysql 4096 7月 28 12:11 include
drwxr-xr-x 4 mysql mysql 4096 7月 28 12:12 lib
drwxr-xr-x 4 mysql mysql 4096 7月 28 12:11 man
drwxr-xr-x 10 mysql mysql 4096 7月 28 12:12 mysql-test
-rw-r--r-- 1 mysql mysql 2478 11月 28 2016 README
drwxr-xr-x 28 mysql mysql 4096 7月 28 12:12 share
drwxr-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
总用量 60
drwxr-xr-x 2 mysql mysql 4096 7月 28 12:12 bin
-rw-r--r-- 1 mysql mysql 17987 11月 28 2016 COPYING
drwxr-x--- 5 mysql mysql 4096 7月 28 13:47 data
drwxr-xr-x 2 mysql mysql 4096 7月 28 12:11 docs
drwxr-xr-x 3 mysql mysql 4096 7月 28 12:11 include
drwxr-xr-x 4 mysql mysql 4096 7月 28 12:12 lib
drwxr-xr-x 4 mysql mysql 4096 7月 28 12:11 man
drwxr-xr-x 10 mysql mysql 4096 7月 28 12:12 mysql-test
-rw-r--r-- 1 mysql mysql 2478 11月 28 2016 README
drwxr-xr-x 28 mysql mysql 4096 7月 28 12:12 share
drwxr-xr-x 2 mysql mysql 4096 7月 28 12:12 support-files
[root@server1 mysql]# /etc/init.d/mysqld start
Starting MySQL. [确定]
[root@server1 mysql]# chown root . -R
[root@server1 mysql]# chown mysql data -R
[root@server1 mysql]# ll
总用量 60
drwxr-xr-x 2 root mysql 4096 7月 28 12:12 bin
-rw-r--r-- 1 root mysql 17987 11月 28 2016 COPYING
drwxr-x--- 5 mysql mysql 4096 7月 28 13:48 data
drwxr-xr-x 2 root mysql 4096 7月 28 12:11 docs
drwxr-xr-x 3 root mysql 4096 7月 28 12:11 include
drwxr-xr-x 4 root mysql 4096 7月 28 12:12 lib
drwxr-xr-x 4 root mysql 4096 7月 28 12:11 man
drwxr-xr-x 10 root mysql 4096 7月 28 12:12 mysql-test
-rw-r--r-- 1 root mysql 2478 11月 28 2016 README
drwxr-xr-x 28 root mysql 4096 7月 28 12:12 share
drwxr-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_installation

Securing 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 password
and allows the users to set only those passwords which are
secure 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 have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

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 at
the 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‘ that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

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 changes
made 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 -p
mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)

mysql 源码安装

标签:rem   bdd   win   add   access   pad   ring   secure   yum   

原文地址:http://blog.51cto.com/13810716/2151444

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!