CentOS下安装Mysql 5.5全过程_MySQL
程序员文章站
2024-04-04 08:20:11
...
CentOS
bitsCN.com
一、安装cmake# 安装所需依赖包yum -y install gcc libxml2-dev curl screen /libpng12-dev autoconf libpcre3-dev make bzip2 /libevent-dev patch libjpeg62-dev libcurl4-openssl-dev /libfreetype6-dev g++ libtool libncurses5-dev psmisc lrzsz # 下载文件wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz # 编译安装tar zxvf cmake-2.8.5.tar.gzcd cmake-2.8.5./boostarpmakemake installcmake –version 二、 安装配置mysql# 下载源文件wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/ftp://ftp.ntu.edu.tw/pub/MySQL/# 或wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz # 创建用户和组groupadd mysqluseradd -g mysql -s /usr/sbin/nologin mysql # 创建安装目录mkdir /usr/local/ mysql # 创建数据库目录mkdir /usr/local/ mysql/data # 解压tar -zxvf mysql-5.5.17.tar.gzcd mysql-5.5.17 # 编译及安装mysql# cmake编译: cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql /-DMYSQL_DATADIR=/usr/local/mysql/data /-DDEFAULT_CHARSET=utf8 /-DDEFAULT_COLLATION=utf8_unicode_ci /-DWITH_READLINE=1 /-DWITH_SSL=system /
-DWITH_EMBEDDED_SERVER=1 /-DENABLED_LOCAL_INFILE=1 /-DDEFAULT_COLLATION=utf8_general_ci /-DWITH_MYISAM_STORAGE_ENGINE=1 /-DWITH_INNOBASE_STORAGE_ENGINE=1 /-DWITH_DEBUG=0 # 安装mysqlmake && make install # 复制配置文件cp support-files/my-medium.cnf /etc/my.cnf # 设置权限chmod +x /usr/local/mysqlchown -R mysql.mysql /usr/local/mysqlchown -R mysql:mysql /usr/local/mysql/data # 配置开机自启动cp support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldchkconfig –add mysqldchkconfg mysqld on # 修改my.cnf配置vim /etc/my.cnf# [mysqld] 添加:datadir=/usr/local/mysql/datadefault-storage-engine=MyISAM # 以下可选:log-error =/usr/local/mysql/data/error.logpid-file = /usr/local/mysql/data/mysql.piduser = mysqltmpdir = /tmp # 初始化数据库/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data & # 启动MySQL/usr/local/mysql/bin/mysqld_safe –defaults-file=/etc/my.cnf &或者:/etc/init.d/mysql start (service mysql start) # 测试MySQL是否启动# 1)查看是否有进程mysqlps -ef | grep mysql# 2)查看端口是否运行netstat -tnl | grep 3306# 3)读取mysql版本信息/usr/local/mysql/bin/mysqladmin version # 至此,MySQL安装完成
bitsCN.com
一、安装cmake# 安装所需依赖包yum -y install gcc libxml2-dev curl screen /libpng12-dev autoconf libpcre3-dev make bzip2 /libevent-dev patch libjpeg62-dev libcurl4-openssl-dev /libfreetype6-dev g++ libtool libncurses5-dev psmisc lrzsz # 下载文件wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz # 编译安装tar zxvf cmake-2.8.5.tar.gzcd cmake-2.8.5./boostarpmakemake installcmake –version 二、 安装配置mysql# 下载源文件wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/ftp://ftp.ntu.edu.tw/pub/MySQL/# 或wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz # 创建用户和组groupadd mysqluseradd -g mysql -s /usr/sbin/nologin mysql # 创建安装目录mkdir /usr/local/ mysql # 创建数据库目录mkdir /usr/local/ mysql/data # 解压tar -zxvf mysql-5.5.17.tar.gzcd mysql-5.5.17 # 编译及安装mysql# cmake编译: cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql /-DMYSQL_DATADIR=/usr/local/mysql/data /-DDEFAULT_CHARSET=utf8 /-DDEFAULT_COLLATION=utf8_unicode_ci /-DWITH_READLINE=1 /-DWITH_SSL=system /
-DWITH_EMBEDDED_SERVER=1 /-DENABLED_LOCAL_INFILE=1 /-DDEFAULT_COLLATION=utf8_general_ci /-DWITH_MYISAM_STORAGE_ENGINE=1 /-DWITH_INNOBASE_STORAGE_ENGINE=1 /-DWITH_DEBUG=0 # 安装mysqlmake && make install # 复制配置文件cp support-files/my-medium.cnf /etc/my.cnf # 设置权限chmod +x /usr/local/mysqlchown -R mysql.mysql /usr/local/mysqlchown -R mysql:mysql /usr/local/mysql/data # 配置开机自启动cp support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldchkconfig –add mysqldchkconfg mysqld on # 修改my.cnf配置vim /etc/my.cnf# [mysqld] 添加:datadir=/usr/local/mysql/datadefault-storage-engine=MyISAM # 以下可选:log-error =/usr/local/mysql/data/error.logpid-file = /usr/local/mysql/data/mysql.piduser = mysqltmpdir = /tmp # 初始化数据库/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data & # 启动MySQL/usr/local/mysql/bin/mysqld_safe –defaults-file=/etc/my.cnf &或者:/etc/init.d/mysql start (service mysql start) # 测试MySQL是否启动# 1)查看是否有进程mysqlps -ef | grep mysql# 2)查看端口是否运行netstat -tnl | grep 3306# 3)读取mysql版本信息/usr/local/mysql/bin/mysqladmin version # 至此,MySQL安装完成
bitsCN.com