欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux下mysql5.5的安装 博客分类: mysql mysqllinux 

程序员文章站 2024-03-18 15:43:01
...
MySQL 5.5使用InnoDB作为默认的数据库存储引擎
下载:http://www.mysql.com/downloads/

mysql 5.5需要用cmake来编译:
安装cmake,及相关包:
yum install  -y \
cmake\
gcc \
gcc-c++  \
ncurses-devel \
bison \
libaio

解压 mysql5.5.tar.gz ,编译:
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysqldata \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_TCP_PORT=3306 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0

然后执行:
make && make install
可以用echo $? 检查每步结果,为0的话就表示成功.
如果想重新make,需清除cmake用:
make clean
rm -f CMakeCache.txt

设置:
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /usr/local/mysql/bin/
chmod 755 /usr/local/mysql/bin/mysql.server
chown -R mysql.mysql  /usr/local/mysql
cd /usr/local/mysql
mkdir /data/mysqldata
scripts/mysql_install_db --user=mysql
cp -rpf /usr/local/mysql/data/* /data/mysqldata
vim /etc/my.cnf  请在[mysqld]下设置这一行:
datadir = /usr/local/mysql/data
添加相对路径:
echo " export PATH=$PATH:/usr/local/mysql/bin"  >> /etc/profile
source /etc/profile

启动和停止Mysql:
mysql.server   start
mysql.server   stop

检测3306端口:
netstat -lnp

编辑 /etc/my.cnf:
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
log-bin=mysql-bin
expire_logs_days = 5
相关标签: mysql linux