CentOS6.5编译安装mysql5.7.11

1、安装相关依赖包

yum-yinstallgcc*autoconfautomakezlib*fiex*libxml*ncurses-devellibmcrypt*libmcrypt*libtool-ltdl-devel*

2、需要安装个包

  • 安装cmake

root@localhostsrc]#tarzxvfcmake-2.8.5.tar.gz

[root@localhostsrc]#cdcmake-2.8.5

[root@localhostcmake-2.8.5]#./bootstrap

…………

--Buildfileshavebeenwrittento:/usr/local/src/cmake-2.8.5

---------------------------------------------

CMakehasbootstrapped.Nowrungmake.

gmake

[100%]BuildingCXXobjectTests/CMakeLib/CMakeFiles/runcompilecommands.dir/run_compile_commands.cxx.o

LinkingCXXexecutableruncompilecommands

[100%]Builttargetruncompilecommands

gmakeinstall

cd..

  • 安装mysql5.7.11

groupaddmysql

useradd-gmysqlmysql

tarzxvfmysql-5.7.11.tar.gz

cdmysql-5.7.11

[root@localhostmysql-5.7.11]#

cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DEXTRA_CHARSETS=all\

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk\

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_MEMORY_STORAGE_ENGINE=1\

-DWITH_READLINE=1\

-DENABLED_LOCAL_INFILE=1\

-DMYSQL_DATADIR=/var/mysql/data\

-DMYSQL_USER=mysql\

-DDOWNLOAD_BOOST=1\

-DWITH_BOOST=/usr/local/boost/boost_1_59_0

CMakeWarning:

Manually-specifiedvariableswerenotusedbytheproject:

MYSQL_USER

WITH_MEMORY_STORAGE_ENGINE

--Buildfileshavebeenwrittento:/usr/local/src/mysql-5.7.11

[root@localhostmysql-5.7.11]#make

[100%]BuildingCXXobjectmysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o

LinkingCXXexecutablemy_safe_process

[100%]Builttargetmy_safe_process

makeinstall

--Installing:/usr/local/mysql/man/man1/mysql_find_rows.1

--Installing:/usr/local/mysql/man/man1/mysql_upgrade.1

--Installing:/usr/local/mysql/man/man1/mysqlimport.1

--Installing:/usr/local/mysql/man/man1/mysql_client_test.1

--Installing:/usr/local/mysql/man/man8/mysqld.8

chmod+w/usr/local/mysql/

chown-Rmysql:mysql/usr/local/mysql/

ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18

mkdir-p/var/mysql

mkdir-p/var/mysql/log/

chown-Rmysql:mysql/var/mysql/

cdsupport-files/

[root@localhostsupport-files]#cpmy-medium.cnf/etc/my.cnf

cpmysql.server/etc/init.d/mysql

[root@localhostsupport-files]#vim /etc/my.cnf

[mysqld]
#Removeleading#andsettotheamountofRAMforthemostimportantdata
#cacheinMySQL.Startat70%oftotalRAMfordedicatedserver,else10%.
#innodb_buffer_pool_size=128M
#Removeleading#toturnonaveryimportantdataintegrityoption:logging
#changestothebinarylogbetweenbackups.
#log_bin=mysql-bin
#Thesearecommonlyset,removethe#andsetasrequired.
basedir=/usr/local/mysql
datadir=/var/mysql/data
port=3306
#server_id=.....
socket=/tmp/mysql.sock
#defaults-file=/etc/my.cnf
explicit_defaults_for_timestamp=true

初始化mysql:

/usr/local/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/var/mysql/data

YoucanstarttheMySQLdaemonwith:

cd/usr/local/mysql;/usr/local/mysql/bin/mysqld_safe&

YoucantesttheMySQLdaemonwithmysql-test-run.pl

cd/usr/local/mysql/mysql-test;perlmysql-test-run.pl

Pleasereportanyproblemswiththe/usr/local/mysql/scripts/mysqlbugscript!


chmod+x/etc/init.d/mysql

vi/etc/init.d/mysql

basedir=/usr/local/mysql

datadir=/var/mysql/data

chkconfig--addmysql

chkconfig--level345mysqlon

cd/usr/local/mysql

[root@localhostmysql]#servicemysqlstart

StartingMySQL..SUCCESS!

mysql

-bash:mysql:commandnotfound

/usr/local/mysql/bin/mysql-urootmysql

mysql>showdatabases;

+--------------------+

|Database|

|information_schema|

|mysql|

|performance_schema|

|test|

4rowsinset(0.01sec)

mysql>exit

Bye

ln-s/usr/local/mysql/bin/mysql/usr/bin

ln-s/usr/local/mysql/bin/mysqladmin/usr/bin

mysql

showdatabases;

4rowsinset(0.00sec)

grantallprivilegeson*.*toroot@'%'identifiedby'123456'withgrantoption;

QueryOK,0rowsaffected(0.00sec)

flushprivileges;

/etc/init.d/iptablesstop;

Flushingfirewallrules:[OK]

SettingchainstopolicyACCEPT:filter[OK]

Unloadingiptablesmodules:[OK]

开启端口3306的访问:

sbin/iptables-IINPUT-ptcp--dport3306-jACCEPT

serviceiptablessave

相关文章

文章浏览阅读903次。4.清除缓存目录(/var/cache/yum)下的软件...
文章浏览阅读1.5k次。Python 是一种高级解释性编程语言,已被...
文章浏览阅读2.6k次。打开终端或控制台,以root或具有sudo权...
文章浏览阅读744次,点赞24次,收藏26次。目标:通过AppSrv为...
文章浏览阅读1.1w次,点赞8次,收藏26次。chmod命令来自于英...
文章浏览阅读1.2k次。yum源的URL地址,本例中是文件系统的路...