受环境所迫,在一台Ubuntu server上安装多个实例MySQL。
手动安装MySQL
环境:Ubuntu server 11.10 64bit + mysql-5.5.17-linux2.6-x86_64.tar.gz
http://www.iteye.com/topic/976422
http://xgbjmxn.iteye.com/blog/1207344
http://www.cnblogs.com/wuhou/archive/2008/09/28/1301071.html
http://www.linuxidc.com/Linux/2008-07/13988.htm
http://brokensmile.blog.51cto.com/948328/647201
1:创建用户组
sudo groupadd mysql
sudo useradd -r -g mysql mysql #-r:创建无登录权限的账户
2:解压缩文件
tar –zxvf mysql-5.5.-linux2.-x86_64.tar.gz
sudo mv mysql-5.5.-linux2.-x86_64 /usr/local/
3:创建symbolic link,并修改访问权限
cd /usr/local/
sudo ln -s mysql-5.5.-linux2.-x86_64 mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
cd mysql/bin
sudo chown -h mysql:mysql libmysqlclient.so. libmysqlclient.so libmysqlclient_r.so. libmysqlclient_r.so
4:创建mysql,初始化授权表
sudo scripts/mysql_install_db --user=mysql # 将文件的所有属性改为root用户。
sudo chown -R root .
# 将数据目录的所有属性改为mysql用户。
sudo chown -R mysql data
# 下面这条给所有人弄data的权限,仅为了方便调试,不需要
sudo chmod a+rwx -R data # 下面的命令可选。copy配置文件到相关目录
sudo cp support-files/my-medium.cnf /etc/my.cnf
启动mysql
sudo bin/mysqld_safe --user=mysql &
# 下面的命令可选。开机自启动mysql.server服务.
# To start mysqld at boot time you have to copy
# support-files/mysql.server to the right place for your system
sudo cp support-files/mysql.server /etc/init.d/mysql.server
service mysql.server start
# 查看启动是否正常
./bin/mysqladmin version
5:修改mysql root用户密码
./bin/mysqladmin -u root -p password ='root'
6: