1.安装环境
[[email protected] ~]# cat /etc/redhat-release CentOS release 6.6 (Final) [[email protected]-mysql-server ~]# uname -r 2.6.32-504.el6.x86_64
2.环境初始化
[[email protected] ~]# /etc/init.d/iptables stop #关闭防火墙 [[email protected]-mysql-server ~]# chkconfig iptables off #禁止开机自启动 [[email protected]-mysql-server ~]# sed -ri ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/selinux/config #关闭SElinux [[email protected]-mysql-server ~]# setenforce 0 #临时关闭SElinux [[email protected]-mysql-server ~]# ntpdate ntp.api.bz #时间同步 #添加定时任务 [[email protected]-mysql-server ~]# echo "*/5 * * * * $(which ntpdate) ntp.api.bz &> /dev/null" >> /var/spool/cron/root
3.安装
[[email protected] ~]# useradd -s /sbin/nologin -M mysql #解析主机名 [[email protected]-mysql-server ~]# echo "$(ifconfig eth0|awk -F ‘[: ]+‘ ‘NR==2 {print $4}‘) $(hostname)" >> /etc/hosts #安装cmake编译工具和依赖库 [[email protected]-mysql-server ~]# yum install cmake ncurses-devel –y [[email protected]-mysql-server ~]# cd tools/ [[email protected]-mysql-server tools]# tar -xf mysql-5.5.32.tar.gz [[email protected]-mysql-server tools]# cd mysql-5.5.32 [[email protected]-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 [[email protected]-mysql-server mysql-5.5.32]# make && make install [[email protected]-mysql-server mysql-5.5.32]# ln -s /app/mysql-5.5.32 /app/mysql [[email protected]-mysql-server mysql-5.5.32]# cd /app/mysql/scripts #初始化 [[email protected]-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! [[email protected]-mysql-server scripts ]# /bin/cp /app/mysql/support-files/my-small.cnf /etc/my.cnf [[email protected]-mysql-server scripts ]# /bin/cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld #添加环境变量 [[email protected]-mysql-server scripts ]# echo "export PATH=$PATH:/app/mysql/bin" >> /etc/profile [[email protected]-mysql-server scripts ]# . /etc/profile [[email protected]-mysql-server scripts ]# /etc/init.d/mysqld start #启动 [[email protected]-mysql-server scripts ]# mysqladmin -uroot password #设置新密码
原文地址:https://www.cnblogs.com/it-art/p/11383647.html
时间: 2024-10-19 12:33:53