Debian编译安装MySQL-Server5.5.x

以root登陆。

安装依赖包:
apt-get install -y gcc libncurses5-dev cmake chkconfig

下载MySQL
wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz

创建MySQL用户
groupadd mysql
useradd -g mysql mysql -s /wp-content/sbin/nologin

创建安装目录
mkdir -p /wp-content/local/platform/mysql

解压mysql
tar zxvf mysql-5.5.17.tar.gz
cd mysql-5.5.17

使用CMAKE编译
cmake -DCMAKE_INSTALL_PREFIX=/wp-content/local/platform/mysql \
-DMYSQL_DATADIR=/data/mysql \
-DDEFAULT_CHARSET=utf8 \
-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_MEMORY_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0

安装

make && make install

以下命令照敲:

cp support-files/my-medium.cnf /wp-content/local/platform/mysql/my.cnf
chmod +x /wp-content/local/platform/mysql
chown -R mysql.mysql /wp-content/local/platform/mysql
cp /wp-content/local/platform/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig –level 2345 mysql on

修改配置文件

vim /wp-content/local/platform/mysql/my.cnf
在mysqld下加入:
datadir=/data/mysqldata
default-storage-engine=MyISAM
user = mysql

初始化数据库

/wp-content/local/platform/mysql/scripts/mysql_install_db –basedir=/wp-content/local/platform/mysql –datadir=/data/mysqldata –user=mysql

启动MySQL

service mysql start

初始化root密码

/wp-content/local/platform/mysql/bin/mysqladmin -u root password 新密码

去打赏

您的支持将鼓励我们继续创作!

[微信] 扫描二维码打赏

发表评论

电子邮件地址不会被公开。