博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql 源码安装
阅读量:6386 次
发布时间:2019-06-23

本文共 5525 字,大约阅读时间需要 18 分钟。

解压软件包,安装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
mysql 源码安装
[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

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)

转载于:https://blog.51cto.com/13810716/2151444

你可能感兴趣的文章
两个关于数列的Python脚本(斐波那契数列和猴子吃香蕉类问题)
查看>>
olabuy-时光从来素默,内心应保持一份素淡与简静
查看>>
Spring Batch Bean 校验 API 支持
查看>>
你的成绩来着于你的努力与决心—PMP
查看>>
kux文件怎么打开 苹果手机如何观看kux视频
查看>>
Python中的urllib.request模块
查看>>
第九课 《说人话》
查看>>
js对象数组排序
查看>>
如何实现在展示商品时,放大商品细节
查看>>
uboot boot流程分析
查看>>
如何学习PHP整个体系的?
查看>>
css三角形实现写法全攻略收集
查看>>
Enterprise and the press public MBT Fora
查看>>
js常用代码整理
查看>>
富文本编辑器TinyMCE
查看>>
01_vue实例_数据_方法
查看>>
“穿越”——正则表达式
查看>>
使用 find 命令实现高级排除需求
查看>>
【DEV GridControl】怎样使GridView中满足某个条件的行可编辑,其余行不可编辑?...
查看>>
一只年轻而倒悬的梨
查看>>