Ubuntu 11.04 x64 编译安装mysql

转自:http://www.cnblogs.com/sink_cup/archive/2011/10/28/ubuntu_x64_mysql.html

 

OS:Ubuntu 11.04 x64

手动安装mysql 5.5.27

什么是mysqlnd:http://cn.php.net/manual/zh/mysqli.overview.php#mysqli.overview.mysqlnd

mysqli、mysql、pdo_mysql的区别:http://cn.php.net/manual/zh/mysqli.overview.php#mysqli.overview.mysqlnd

从mysql.com下载最新版的,有rpm自动安装包给Federo、CentOS用,没有deb包。所以Ubuntu要手动安装。下载 Linux - Generic 2.6 (x86, 64-bit), Compressed TAR Archive。参考:http://dev.mysql.com/doc/refman/5.5/en/binary- installation.html

下载地址: http://www.mysql.com/downloads/mysql/

echo 复制下面整段shell到命令行终端中,会自动逐条执行。
sudo apt-get install -y libaio1
sudo apt-get remove -y mysql-common mysql-server mysql-client
sudo rm -rf /etc/mysql/
wget -O mysql-5.5.27-linux2.6-x86_64.tar.gz http://www.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.27-linux2.6-x86_64.tar.gz/from/http://cdn.mysql.com/
tar -zxvf mysql-5.5.27-linux2.6-x86_64.tar.gz
sudo mv ./mysql-5.5.27-linux2.6-x86_64 /usr/local/mysql
sudo groupadd mysql
sudo useradd -r -g mysql mysql
cd /usr/local/mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql
sudo chown -R root .
sudo chown -R mysql data
sudo cp support-files/my-medium.cnf /etc/my.cnf
sudo ln -s /usr/local/mysql/bin/mysql /usr/bin/
sudo ln -s /usr/local/mysql/bin/mysqldump /usr/bin/
sudo cp support-files/mysql.server /etc/init.d/mysql
sudo /etc/init.d/mysql start
./bin/mysqladmin -u root password '1'
sudo /etc/init.d/mysql restart
mysql -uroot -p1



添加服务 让mysqld开机自动启动

sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
sudo update-rc.d mysql defaults



安装完成,需要配置mysql。请看:http://www.cnblogs.com/sink_cup/archive/2011/10/28/mysql_conf.html

说明:之前写的文章太长,有重复,违反DRY,现在整理出来。

你可能感兴趣的:(ubuntu)