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

Centos-6.6源码安装MySQL-5.5

时间:2019-08-20 16:54:07      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:null   添加   技术   源码   临时   kconfig   sql   har   class   

 

1.安装环境

 

技术图片
[root@linux-mysql-server ~]# cat /etc/redhat-release 
CentOS release 6.6 (Final)

[root@linux-mysql-server ~]# uname -r
2.6.32-504.el6.x86_64
View Code

 

2.环境初始化

技术图片
[root@linux-mysql-server ~]#  /etc/init.d/iptables stop   #关闭防火墙

[root@linux-mysql-server ~]#  chkconfig iptables off    #禁止开机自启动

[root@linux-mysql-server ~]#  sed -ri s#SELINUX=enforcing#SELINUX=disabled#g /etc/selinux/config  #关闭SElinux

[root@linux-mysql-server ~]#  setenforce 0        #临时关闭SElinux

[root@linux-mysql-server ~]#  ntpdate ntp.api.bz  #时间同步

#添加定时任务
[root@linux-mysql-server ~]#  echo "*/5 * * * * $(which ntpdate) ntp.api.bz &> /dev/null" >> /var/spool/cron/root
View Code

 

 

3.安装

技术图片
[root@linux-mysql-server ~]# useradd -s /sbin/nologin  -M mysql

#解析主机名
[root@linux-mysql-server ~]# echo "$(ifconfig eth0|awk -F ‘[: ]+‘ ‘NR==2 {print $4}‘) $(hostname)" >> /etc/hosts


#安装cmake编译工具和依赖库
[root@linux-mysql-server ~]# yum install cmake ncurses-devel –y



[root@linux-mysql-server ~]# cd tools/
[root@linux-mysql-server tools]# tar -xf mysql-5.5.32.tar.gz

[root@linux-mysql-server tools]# cd mysql-5.5.32

[root@linux-mysql-server mysql-5.5.32]# cmake -DCMAKE_INSTALL_PREFIX=/app/mysql-5.5.32 -DMYSQL_DATADIR=/app/mysql-5.5.32/data -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/app/mysql-5.5.32/data/mysqld.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1

[root@linux-mysql-server mysql-5.5.32]# make && make install
[root@linux-mysql-server mysql-5.5.32]# ln -s /app/mysql-5.5.32 /app/mysql
[root@linux-mysql-server mysql-5.5.32]# cd /app/mysql/scripts 

#初始化
[root@linux-mysql-server scripts ]# ./mysql_install_db --basedir=/app/mysql --datadir=/app/mysql/data/ --user=mysql
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:

/app/mysql/bin/mysqladmin -u root password new-password
/app/mysql/bin/mysqladmin -u root -h linux-mysql-server.com password new-password

Alternatively you can run:
/app/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 /app/mysql ; /application/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /app/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /app/mysql/scripts/mysqlbug script!



[root@linux-mysql-server scripts ]# /bin/cp  /app/mysql/support-files/my-small.cnf  /etc/my.cnf 
[root@linux-mysql-server scripts ]# /bin/cp  /app/mysql/support-files/mysql.server  /etc/init.d/mysqld 

#添加环境变量
[root@linux-mysql-server scripts ]#  echo "export PATH=$PATH:/app/mysql/bin" >> /etc/profile
[root@linux-mysql-server scripts ]# . /etc/profile

[root@linux-mysql-server scripts ]# /etc/init.d/mysqld start  #启动

[root@linux-mysql-server scripts ]# mysqladmin -uroot password #设置新密码
View Code

 

Centos-6.6源码安装MySQL-5.5

标签:null   添加   技术   源码   临时   kconfig   sql   har   class   

原文地址:https://www.cnblogs.com/it-art/p/11383647.html

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