关闭防火墙
Systemctl stop firewall Setenforce 0
检查是否安装过MySQL
rpm -qa |grep mysql [[email protected]~]# rpm -qa|grep mariadb centos7默认数据库 mariadb-libs-5.5.44-1.el7_1.x86_64 [[email protected]~]# rpm -e --nodeps mariadb-libs-5.5.44-1.el7_1 强制卸载
安装编译代码所需要的包
[[email protected] ~]# yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio libaio-devel perl-Data-Dumper net-tools
解压并安装
[[email protected] ~]# tar zxf mysql-5.5.17.tar.gz [[email protected] ~]# cd mysql-5.5.17/ [[email protected] mysql-5.5.17]# cmake > -DCMAKE_INSTALL_PREFIX=/usr/local/mysql > -DMYSQL_DATADIR=/usr/local/mysql/data > -DSYSCONFDIR=/etc > -DWITH_MYISAM_STORAGE_ENGINE=1 > -DWITH_INNOBASE_STORAGE_ENGINE=1 > -DWITH_MEMORY_STORAGE_ENGINE=1 > -DWITH_READLINE=1 > -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock > -DMYSQL_TCP_PORT=3306 > -DENABLED_LOCAL_INFILE=1 > -DWITH_PARTITION_STORAGE_ENGINE=1 > -DEXTRA_CHARSETS=all > -DDEFAULT_CHARSET=utf8 > -DDEFAULT_COLLATION=utf8_general_ci [[email protected] mysql-5.5.17]# make && make install
创建MySQL用户组和用户
[[email protected] mysql-5.5.17]# groupadd mysql [[email protected] mysql-5.5.17]# useradd -g mysql mysql 修改mysql目录权限 [[email protected] mysql-5.5.17]# chown -R mysql:mysql /usr/local/mysql 启动mysql 拷贝文件 [[email protected] mysql-5.5.17]# cp support-files/mysql.server /etc/init.d/mysql [[email protected] mysql-5.5.17]# chkconfig mysql on #开机启动 [[email protected] mysql-5.5.17]# service mysql start #启动mysql Starting MySQL... SUCCESS! Netstat -lnp|grep 3306 #检查端口
时间: 2024-10-11 05:31:53