时间:2021-07-01 10:21:17 帮助过:4人阅读
yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
这两个网站mysql 资源比较丰富
mirrors.sohu.com
ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.5/
ftp://ftp.pku.edu.cn/open/db/MySQL/
1 安装所需要系统库相关库文件
[root@localhost ~]# yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
这两个网站mysql 资源比较丰富 |
2. 安装 cmake
[root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz [root@localhost ~]# yum install cmake |
3. 编译安装 MySQL 5.5.14
[root@localhost ~]# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.14.tar.gz
[root@localhost ~]# /usr/sbin/groupadd mysql //防止出现gdb调试时,出现value has been optimized out
|
4. 配置启动MySQL 5.5.14
1. 若有需要请先修改 mysql 的配置 my.cnf [root@localhost ~]# vi /etc/my.cnf 在[mysqld]下面添加 basedir = /usr/local/mysql-5.5.14 datadir = /usr/local/mysql-5.5.14/data log-error = /usr/local/mysql-5.5.14/mysql_error.log pid-file = /usr/local/mysql-5.5.14/data/mysql.pid default-storage-engine=MyISAM user = mysql 2. mysql 初始化安装 执行以下命令 [root@localhost ~]# /usr/local/mysql/scripts/mysql_install_db \ --basedir=/usr/local/mysql \ --datadir=/var/mysql/data \ --user=mysql 3. 将 mysql 加入开机启动 [root@localhost ~]# chmod +x /etc/init.d/mysqld [root@localhost ~]# vi /etc/init.d/mysqld (编辑此文件,查找并修改以下变量内容:) basedir=/usr/local/mysql datadir=/var/mysql/data [root@localhost ~]# chkconfig --add mysqld [root@localhost ~]# chkconfig --level 345 mysqld on 为MySQL配置环境变量,以后使用起来方便 # export PATH=/usr/local/mysql/bin:$PATH 4. 启动 mysql [root@localhost ~]# service mysqld start 设置密码 [root@localhost ~]# mysql_secure_installation 注意:如果出现 Starting MySQL...The server quit without updating PID file 报错: Starting MySQL...The server quit without updating PID file 查看错误日志 情景1: 110206 12:58:35 [ERROR] Can‘t start server : Bind on unix socket: No such file or directory 110206 12:58:35 [ERROR] Do you already have another mysqld server running on socket: /mysql/mysqldir/data/mysql.sock ? 110206 12:58:35 [ERROR] Aborting [root@localhost ~]# ps -ef | grep mysql # 未发现有mysqld. [root@localhost ~]# netstat -an | grep 3306 也未发现异常. 最后从mysql安装目录下重新复制一个配置文件到/etc/my.cnf 修改相应参数.于是问题解决 情景2: /mysql/mysqldir/bin/mysqld: Table ‘mysql.plugin‘ doesn‘t exist [ERROR] Can‘t open the mysql.plugin table. Please run my sql_upgrade to create it. 原因:编译安装后忘记初始化表. 解决:运行mysql_install_db 其他情况,查看日志文件(我的是localhost.localdomain.err,具体因人而异),然后具体分析; |
安装mysql
标签: