在本文中,我们将为您详细介绍centOS6.4源码安装Mysql5.6.39的相关知识,此外,我们还会提供一些关于CentOS5.5下源码安装MySQL5.5、CentOS5.6下源码安装MySQL5
在本文中,我们将为您详细介绍centOS6.4 源码安装Mysql 5.6.39的相关知识,此外,我们还会提供一些关于CentOS 5.5下源码安装MySQL 5.5、CentOS 5.6下源码安装MySQL 5.1.56、centos 6 源码安装mysql 8、centos 6.10源码安装mysql5.5.62实验的有用信息。
本文目录一览:- centOS6.4 源码安装Mysql 5.6.39
- CentOS 5.5下源码安装MySQL 5.5
- CentOS 5.6下源码安装MySQL 5.1.56
- centos 6 源码安装mysql 8
- centos 6.10源码安装mysql5.5.62实验
centOS6.4 源码安装Mysql 5.6.39
1、关闭防火墙
service iptables stop
chkconfig iptables off
setenforce 0
vi /etc/selinux/config
SELINUX=permissive
2、配置sysctl.conf
主要配置shmmax共享内存类参数,最大设置为50%-60%系统物理内存。
3、检查操作系统是否安装了MysqL
如果需要删除MysqL,可以执行:
rpm -e MysqL-libs-5.1.66-2.el6_3.x86_64
如果因为依赖删不掉,则可以用yum来删:
yum remove MysqL-libs-5.1.66-2.el6_3.x86_64
再检查一下MysqL的安装包是否存在:
4、下载MysqL源码包
[root@MysqL yum.repos.d]# mkdir /u01
[root@MysqL yum.repos.d]# cd /u01
[root@MysqL u01]#
配置ftp,上传源码
a、配置源http://blog.csdn.net/kadwf123/article/details/78231694
b、配置ftp服务
yum -y install vsftpd
chkconfig vsftpd on
cd /etc/vsftpd
vi ftpusers
把root用户注释掉
vi user_list
把root用户注释掉
5、添加用户和组
groupadd MysqL
创建MysqL组
创建MysqL用户
设置MysqL用户的密码:
6、配置MysqL环境变量
su - MysqL
vi .bash_profile
修改path变量:
使之生效
7、创建目录及授权
[root@MysqL vsftpd]# mkdir -p /u01/my3306/data
[root@MysqL vsftpd]# mkdir -p /u01/my3306/log/iblog
[root@MysqL vsftpd]# mkdir -p /u01/my3306/log/binlog
[root@MysqL vsftpd]# mkdir -p /u01/my3306/run
[root@MysqL vsftpd]# mkdir -p /u01/my3306/tmp
[root@MysqL vsftpd]#
授权:
[root@MysqL vsftpd]# chown -R MysqL:MysqL /u01/my3306
[root@MysqL vsftpd]# chmod -R 755 /u01/my3306
[root@MysqL vsftpd]#
8、解压MysqL5.6
tar -xzvf mysql-5.6.39.tar.gz
9、配置yum源,安装cmake
yum install -y cmake gcc gcc-c++ ncurses-devel bison zlib libxml openssl openssl-devel ncurses
安装上面的所有的依赖包,确保安装成功。
10、编译并安装
进入MysqL源码包的解压目录
执行如下命令:
cmake \
-DCMAKE_INSTALL_PREFIX=/u01/my3306 \
-DINSTALL_DATADIR=/u01/my3306/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_SSL=yes \
-DWITH_EMbedDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMysqL_UNIX_ADDR=/u01/my3306/run/MysqL.sock \
-DMysqL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DSYSconfdIR=/etc \
-DWITH_READLINE=on
失败,老是报错: CMake Error at cmake/ssl.cmake:167 (FILE): file STRINGS file "/u01/mysql-5.6.39/OPENSSL_INCLUDE_DIR-NOTFOUND/openssl/opensslv.h" cannot be read. Call Stack (most recent call first): CMakeLists.txt:446 (MysqL_CHECK_SSL) -- OPENSSL_INCLUDE_DIR = OPENSSL_INCLUDE_DIR-NOTFOUND -- OPENSSL_LIBRARY = OPENSSL_LIBRARY-NOTFOUND -- CRYPTO_LIBRARY = CRYPTO_LIBRARY-NOTFOUND -- OPENSSL_MAJOR_VERSION = CMake Error at cmake/ssl.cmake:247 (MESSAGE): Cannot find appropriate system libraries for SSL. Make sure you've specified a supported SSL version. Consult the documentation for WITH_SSL alternatives Call Stack (most recent call first): CMakeLists.txt:446 (MysqL_CHECK_SSL) -- Using cmake version 2.8.12.2 -- Not building NDB -- Library MysqLclient depends on OSLIBS -lpthread;m;rt;dl -- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source. -- If you are inside a firewall,you may need to use an https proxy: export https_proxy=http://example.com:80 -- Library MysqLserver depends on OSLIBS -lpthread;m;rt;crypt;dl -- Skipping deb packaging on unsupported platform . -- CMAKE_BUILD_TYPE: RelWithDebInfo -- COMPILE_DEFinitioNS: HAVE_CONfig_H -- CMAKE_C_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement -- CMAKE_CXX_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -- Configuring incomplete,errors occurred! See also "/u01/mysql-5.6.39/CMakeFiles/CMakeOutput.log". See also "/u01/mysql-5.6.39/CMakeFiles/CMakeError.log". [root@MysqL mysql-5.6.39]# ll 注意这个地方:
怀疑是openssl导致的,但是我的openssl检查却装了。
没办法,下一个在装,然后指定:
-DOPENSSL_ROOT_DIR=/usr/local/openssl \
-DOPENSSL_LIBRARIES=/usr/local/openssl/lib \
这两项。完整命令如下:
cmake \
-DCMAKE_INSTALL_PREFIX=/u01/my3306 \
-DMysqL_DATADIR=/u01/my3306/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_SSL=yes \
-DWITH_EMbedDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMysqL_UNIX_ADDR=/u01/my3306/run/MysqL.sock \
-DMysqL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DSYSconfdIR=/etc \
-DOPENSSL_ROOT_DIR=/usr/local/openssl \
-DOPENSSL_LIBRARIES=/usr/local/openssl/lib \
-DWITH_READLINE=on
下面说明使用二进制包安装openssl:
a、下载新版openssl安装包:https://www.openssl.org/source/
b、把安装文件openssl-1.0.2n.tar.gz上传到虚拟机。
c、tar -xzvf openssl-1.0.2n.tar.gz
d、cd openssl-1.0.2n
e、执行命令:./config --prefix=/usr/local/openssl -fPIC no-gost no-shared no-zlib
注意,如果不指定 -fPIC选项,可能会出现如下错误:
Scanning dependencies of target clientlib [ 82%] Building C object libMysqL/CMakeFiles/clientlib.dir/get_password.c.o [ 83%] Building C object libMysqL/CMakeFiles/clientlib.dir/libMysqL.c.o [ 83%] Building C object libMysqL/CMakeFiles/clientlib.dir/errmsg.c.o [ 83%] Building C object libMysqL/CMakeFiles/clientlib.dir/__/sql-common/client.c.o [ 83%] Building C object libMysqL/CMakeFiles/clientlib.dir/__/sql-common/my_time.c.o [ 83%] Building C object libMysqL/CMakeFiles/clientlib.dir/__/sql-common/client_plugin.c.o [ 83%] Building CXX object libMysqL/CMakeFiles/clientlib.dir/__/sql-common/client_authentication.cc.o [ 83%] Building CXX object libMysqL/CMakeFiles/clientlib.dir/__/sql/net_serv.cc.o [ 83%] Building C object libMysqL/CMakeFiles/clientlib.dir/__/sql-common/pack.c.o [ 83%] Building C object libMysqL/CMakeFiles/clientlib.dir/__/sql/password.c.o Linking CXX static library libclientlib.a [ 83%] Built target clientlib Scanning dependencies of target libMysqL [ 83%] Building CXX object libMysqL/CMakeFiles/libMysqL.dir/libMysqL_exports_file.cc.o Linking CXX shared library libMysqLclient.so /usr/bin/ld: /usr/local/openssl/lib/libssl.a(t1_srvr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/openssl/lib/libssl.a: Could not read symbols: Bad value collect2: ld 返回 1 make[2]: *** [libMysqL/libMysqLclient.so.18.1.0] 错误 1 make[1]: *** [libMysqL/CMakeFiles/libMysqL.dir/all] 错误 2 make: *** [all] 错误 2 [root@MysqL mysql-5.6.39]#
主要注意:
f、执行命令:make depend
g、执行命令:./config -t
h、执行make,编译openssl。注意执行make要有gcc编译器。
i、执行make install进行安装。
j、执行cd /usr/local
k、执行ldd /usr/local/openssl/bin/openssl
l、配置环境变量:PATH=/usr/local/openssl/bin:$PATH:$HOME/bin
m、使环境变量生效source /root/.bash_profile
n、which openssl
o、查看版本:openssl version
然后就可以执行cmake成功了:
多次cmake需要删除CMakeCache.txt 文件
cd/u01/mysql-5.6.39/
rm -fCMakeCache.txt
下面直接进行make编译:
make
这条命令执行的时间比较长,前台一直会输出make的进度:
然后还需要执行make install安装到指定目录/u01/my3306中。
11、MysqL参数配置
把my.cnf参数文件直接传到/u01/my3306/目录下面去。
也可以直接建一个my.cnf,内容如下:
[client] port=3306 socket=/u01/my3306/MysqL.sock [MysqL] pid_file=/u01/my3306/run/MysqLd.pid [MysqLd] autocommit=1 general_log=off explicit_defaults_for_timestamp=true # system basedir=/u01/my3306 datadir=/u01/my3306/data max_allowed_packet=1g max_connections=3000 max_user_connections=2800 open_files_limit=65535 pid_file=/u01/my3306/run/MysqLd.pid port=3306 server_id=101 skip_name_resolve=ON socket=/u01/my3306/run/MysqL.sock tmpdir=/u01/my3306/tmp #binlog log_bin=/u01/my3306/log/binlog/binlog binlog_cache_size=32768 binlog_format=row expire_logs_days=7 log_slave_updates=ON max_binlog_cache_size=2147483648 max_binlog_size=524288000 sync_binlog=100 #logging log_error=/u01/my3306/log/error.log slow_query_log_file=/u01/my3306/log/slow.log log_queries_not_using_indexes=0 slow_query_log=1 log_slave_updates=ON log_slow_admin_statements=1 long_query_time=1 #relay relay_log=/u01/my3306/log/relaylog relay_log_index=/u01/my3306/log/relay.index relay_log_info_file=/u01/my3306/log/relay-log.info #slave slave_load_tmpdir=/u01/my3306/tmp slave_skip_errors=OFF #innodb innodb_data_home_dir=/u01/my3306/log/iblog innodb_log_group_home_dir=/u01/my3306/log/iblog innodb_adaptive_flushing=ON innodb_adaptive_hash_index=ON innodb_autoinc_lock_mode=1 innodb_buffer_pool_instances=8 #default innodb_change_buffering=inserts innodb_checksums=ON innodb_buffer_pool_size= 128M innodb_data_file_path=ibdata1:32M;ibdata2:16M:autoextend innodb_doublewrite=ON innodb_file_format=Barracuda innodb_file_per_table=ON innodb_flush_log_at_trx_commit=1 innodb_flush_method=O_DIRECT innodb_io_capacity=1000 innodb_lock_wait_timeout=10 innodb_log_buffer_size=67108864 innodb_log_file_size=1048576000 innodb_log_files_in_group=4 innodb_max_dirty_pages_pct=60 innodb_open_files=60000 innodb_purge_threads=1 innodb_read_io_threads=4 innodb_stats_on_Metadata=OFF innodb_support_xa=ON innodb_use_native_aio=OFF innodb_write_io_threads=10 [MysqLd_safe] datadir=/u01/my3306/data
然后把/u01/my3306目录属主改成MysqL
chown -R MysqL:MysqL /u01/my3306
12、初始化MysqL脚本
cd /u01/my3306/scripts
./MysqL_install_db --help
./scripts/MysqL_install_db --defaults-file=/u01/my3306/my.cnf --datadir=/u01/my3306/data --user=MysqL
注意此命令要在/u01/my3306目录下执行。
13、启动MysqL
[MysqL@MysqL bin]$ pwd
/u01/my3306/bin
[MysqL@MysqL bin]$ ./MysqLd_safe --defaults-file=/u01/my3306/my.cnf --user=MysqL &
检查MysqL进程:
14、登录MysqL
登录MysqL
CentOS 5.5下源码安装MySQL 5.5
一、安装依赖包. 1.yum install cmake 2.yum install gcc-c++ 3.yum install ncurses-devel 二、解压源码包 1.tar -zxvf mysql-5
首页 → 数据库技术
背景:
阅读新闻
centos 5.5下源码安装mysql 5.5
[日期:2012-06-17] 来源:Linux社区 作者:m582445672 [字体:]
一、安装依赖包.
1.yum install cmake
2.yum install gcc-c++
3.yum install ncurses-devel
二、解压源码包
1.tar -zxvf mysql-5.5.8.tar.gz
进入解压文件中.......
三、编译+安装
1.执行
cmake -DCMAKE_INSTALL_PREFIX=/home/mysql_service/first_mysql/ -DMYSQL_DATADIR=/home/mysql_service/first_mysql/data -DSYSCONFDIR=/home/mysql_service/first_mysql/ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/home/mysql_service/first_mysql/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DMYSQL_USER=mysql
2.make
3.make install
四、更换配置文件路径
在mysql目录下面的./mysql/support-files/
cp my-medium.cnf ../my.cnf
五、安装mysql系统库
进入mysql目录下面的 ./mysql/scripts/
1.执行
./mysql_install_db --basedir=/home/mysql_service/first_mysql --datadir=/home/mysql_service/first_mysql/data --defaults-file=/home/mysql_service/first_mysql/my.cnf --user=mysql
# 一定要指定配置文件的路径,默认是在/etc/my.cnf
六、编写MySQL启动脚
#! /bin/sh
/home/mysql-server/mysql/bin/mysqld_safe --defaults-file=/home/mysql_service/first_mysql/my.cnf --datadir=/home/mysql_service/first_mysql/data --pid-file=/home/mysql_service/first_mysql/data/cos54110629.pid --socket=/home/mysql_service/first_mysql/mysqld.sock --user=mysql&
七、登录
登录时指定mysqld.sock的路径
mysql -S /home/mysql_service/first_mysql/mysqld.sock
Mysqlbackup 备份详解(MySQL官方备份工具)
Oracle 11.2.0.1.0通过RMAN在Windows XP上创建物理standby
相关资讯 MySQL安装教程
图片资讯
本文评论 查看全部评论 (0)
评论声明
最新资讯
本周热门
Linux公社简介 - 广告服务 - 网站地图 - 帮助信息 - 联系我们
本站(LinuxIDC)所刊载文章不代表同意其说法或描述,,仅为提供更多信息,也不构成任何建议。
Copyright © 2006-2011 Linux公社 All rights reserved 浙ICP备06018118号
CentOS 5.6下源码安装MySQL 5.1.56
install_mysql_centos5.6总结:其实事情很简单,答案一直就在跟前,我们却总很容易将他们忽视掉,用心想,静静地看,答案就在那里
install_mysql_centos5.6
总结:其实事情很简单,答案一直就在跟前,我们却总很容易将他们忽视掉,用心想,静静地看,答案就在那里。
1. download mysql-5.1.56.tar.gz to /opt/src
2. $cd /opt/src
3. $tar -zxvf mysql-5.1.56.tar.gz
4. $cd mysql-5.1.56
5. $mkdir -p /opt/apps/mysql-5.1.56 /opt/etc/mysql /opt/var/mysql
/opt/tmp/mysql
6. $./configure --prefix=/opt/apps/mysql-5.1.56/ \
--sysconfdir=/opt/etc/mysql/ \
--localstatedir=/opt/var/mysql/ \
--with-unix-socket-path=/opt/tmp/mysql/mysql.sock \
--with-tcp-port=3306 \
--with-charset=utf8 \
--with-extra-charsets=gb2312,gbk
7. $make
8. $make install
9. $su - root
10.$sudo cp /opt/src/support-files/my-medium.cnf /etc/my.cnf
11.$sudo groupadd mysql
12.$sudo useradd -g mysql mysql
13.$sudo chown -r mysql:mysql /opt/var/mysql
14.$sudo chown -r mysql:mysql /opt/tmp/mysql/
14.$ln -s /opt/apps/mysql-5.1.56 /opt/apps/mysql
15.$sudo vim /etc/my.cnf
instead skip-locking by #skip-locking
add:
skip-external-locking
16.$sudo ./mysql/bin/mysql_install_db --user=mysql
note:
generate the initial privileges or grant tables
17. 启动mysql服务
$sudo /opt/apps/mysql/bin/mysqld_safe &
note:
starts the mysqld_safe daemon, which will in turn start the mysql server mysqld.
if the mysqld daemon crashes,mysqld_safe will restart it.
the ampersand instructs the shell to run the daemon in the background.
18.关闭mysql服务
$/opt/apps/mysql/bin/mysqladmin -u root shutdown
19.设置root密码
$/opt/apps/mysql/bin/mysqladmin -u root password ''new-password''
20.设置密码后,关闭服务
$/opt/apps/mysql/bin/mysqladmin -uroot -ppassword shutdown
或者
$/opt/apps/mysql/bin/mysqladmin -u root -p shutdown
21. 登录mysql
$mysql -u root -p
或者
$mysql -uroot -ppasswd
22.设置开机启动
$su - root
#cp /opt/src/mysql-5.1.56/support-files/mysql.server /etc/init.d/mysql
注:place the startup file for the server in the server''s initial daemons directory
with the name mysql.
#chmod +x /etc/init.d/mysql
#chkconfig --add mysql
注:set the run level of the service for startup and shutdown
23. 至此可以通过相关设置
#chkconfig mysql off //设置不随机启动
#chkconfig mysql on //重新随即启动
24.启动mysql也可以更加方便
#/etc/init.d/mysql start //启动
#/etc/init.d/mysql stop //关闭
#/etc/init.d/mysql restart
或者
#service mysql start
....................................
1. error: no curses/termcap library found
sudo yum install ncurses-devel
curses构成了一个工作在底层终端代码之上的封装,并向用户提供了一个灵活高效的api
(application programming interface 应用程序接口)。它提供了移动光标,
建立窗口,产生颜色,处理鼠标操作等功能。使程序员编写应用程序不需要关心那些底层的
终端操作。
ncurses是最早的system v release 4.0 (svr4)中 curses的一个克隆。这是一个
可自由配置的库,完全兼容旧版本的curses。简而言之,它是一个管理应用程序在字符终
端显示的函数库。当后面提到curses的时候,同时也可以和ncurses互换。
2. exec: g++: not found
sudo yum install gcc-c++
3. 错误:对 c++ 内建类型 ‘bool’ 的重声明
重新./configure一下,然后再make就好了。
4. ''--skip-locking'' is deprecated and will be removed in a future release. please use ''--skip-external-locking'' instead.、
5. 执行脚本
$sudo ./mysql/bin/mysql_install_db --user=mysql
时,出现的话,,你看过吗,却傻巴垃圾的去问人,去google.
installing mysql system tables...
ok
filling help tables...
ok
to start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
please remember to set a password for the mysql root user !
to do so, start the server, then issue the following commands:
/opt/apps/mysql-5.1.56/bin/mysqladmin -u root password ''new-password''
/opt/apps/mysql-5.1.56/bin/mysqladmin -u root -h net.yy.com password ''new-password''
alternatively you can run:
/opt/apps/mysql-5.1.56/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. this is
strongly recommended for production servers.
see the manual for more instructions.
you can start the mysql daemon with:
cd /opt/apps/mysql-5.1.56 ; /opt/apps/mysql-5.1.56/bin/mysqld_safe &
you can test the mysql daemon with mysql-test-run.pl
cd /opt/apps/mysql-5.1.56/mysql-test ; perl mysql-test-run.pl
please report any problems with the /opt/apps/mysql-5.1.56/bin/mysqlbug script!
centos 6 源码安装mysql 8
1
wget https://copr.fedoraproject.org/coprs/rhscl/devtoolset-3/repo/epel-6/rhscl-devtoolset-3-epel-6.repo -O /etc/yum.repos.d/rhscl-devtoolset-3-epel-6.repo
2
yum install -y scl-utils policycoreutils-python
3
yum --disablerepo=‘*‘ --enablerepo=‘rhscl-devtoolset-3‘ install devtoolset-3-gcc devtoolset-3-gcc-c++
4
source /opt/rh/devtoolset-3/enable
5验证:
gcc --version
二,编译,安装MysqL
1,下载最新的GA版本:
https://www.percona.com/downloads/Percona-Server-LATEST/Percona-Server-8.0.13-4/source/tarball/percona-server-8.0.13-4.tar.gz
2,解压
tar -zxvf percona-server-8.0.13-4.tar.gz
3,编译
cd percona-server-8.0.13
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONfig=MysqL_release -DFEATURE_SET=community -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost -DCMAKE_INSTALL_PREFIX=/usr/local/MysqL/p8.0.13
4,安装:
make && make install
5,初始化:
MysqLd --defaults-file=/etc/my.cnf --initialize-insecure --user=MysqL
--备注:
初始化时要看日志,确认初始化成功
6,启动MysqL 8
/bin/sh /usr/local/MysqL/p8.0.13/bin/MysqLd_safe --defaults-file=/etc/my.cnf
7,登录:
初始化时root用户是空密码,登录后创建新的DBA帐号并删除这个空密码帐号
--备注:编译安装时间较长,但可以定制化,也可以直接用进制包来安装,下载对应版本即可
centos 6.10源码安装mysql5.5.62实验
查看系统版本
[root@ABC ~]# cat /etc/redhat-release
CentOS release 6.10 (Final)
下载mysql5.5.62源码包,解压后安装
tar –zxf mysql-5.5.62.tar.gz -C /usr/local/src
根据提示安装必要的依赖库文件
yum install -y gcc gcc-c++ ncurses-devel git cmake
预编译规划
Mysql软件安装目录/usr/local/mysql;mysql数据目录为/usr/local/mysql/data;
Mysql错误日志文件保存目录为/var/log/mysql/error.log,创建相应目录和用户并赋权
groupadd mysql&&useradd –r –g mysql –s /sbin/false
mkdir –p /usr/local/mysql/data&&chown –R mysql:mysql /usr/local/mysql
mkdir /var/log/mysql&&chown –R mysql:mysql /var/log/mysql
进入解压包目录,使用cmake预编译
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data/ -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1
编译安装
make –j 4&& make install –j 4
进入安装目录执行操作
cd /usr/local/mysql
拷贝mysql服务脚本文件到系统目录
cp support-files/mysql.server /ect/init.d/mysqld
设置mysqld服务为开机自启动
chkconfig - -level 3 mysqld on
chkconfig - -list mysqld
启动mysql服务
service mysqld start
启动报错,无法正常启动
安装完5.5.62的mysql后,必需要先执行mysql_install_db才能执行后续操作
[root@ABC mysql]#/usr/local/mysql/ scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
/usr/local/mysql/bin/mysqladmin -u root password ''new-password''
/usr/local/mysql/bin/mysqladmin -u root -h 主机名 password ''new-password''
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
启动mysql服务
[root@ABC mysql]# service mysqld start
Starting MySQL SUCCESS!
修改环境变量,将mysql命令添加到系统中
PATH=$PATH:/usr/local/mysql/bin
要想使命令永久生效,需要将该命令添加到$HOME/.bashrc_profile文件末尾即可,
使用source $HOME/.bashrc_profile 让命令生效
安全初始化mysql
[root@ABC ~]# mysql_secure_installation
登陆mysql
[root@ABC ~]# mysql –u root –p password
查看端口和状态
[root@ABC mysql]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 23441/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2195/sshd
tcp 0 0 :::80 :::* LISTEN 1744/httpd
tcp 0 0 :::22 :::* LISTEN 2195/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1231/dhclient
[root@ABC mysql]# ps -ef | grep mysql
root 23145 1991 0 18:34 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysql 23441 23145 0 18:34 pts/0 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=ABC.pid --socket=/usr/local/mysql/mysql.sock --port=3306
root 23872 1991 0 19:36 pts/0 00:00:00 grep mysql
重启测试
[root@b mysql]# service mysqld restart
ERROR! MySQL server PID file could not be found!
无法启动,提示server PID无法找到关闭selinux防火墙并重启测试
[root@b mysql]# vim /etc/selinux/config
[root@b mysql]# reboot
[root@ABC ~]# service mysqld restart
Shutting down MySQL. SUCCESS!
Starting MySQL.. SUCCESS!
至此数据库安装成功。
今天的关于centOS6.4 源码安装Mysql 5.6.39的分享已经结束,谢谢您的关注,如果想了解更多关于CentOS 5.5下源码安装MySQL 5.5、CentOS 5.6下源码安装MySQL 5.1.56、centos 6 源码安装mysql 8、centos 6.10源码安装mysql5.5.62实验的相关知识,请在本站进行查询。
本文标签: