1. 安装文件准备
server rpm x64
http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.21-1.linux2.6.x86_64.rpm/from/http://gd.tuwien.ac.at/db/mysql/
client rpm x64
http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.21-1.linux2.6.x86_64.rpm/from/http://mysql.easynet.be/
下载地址:
http://dev.mysql.com/downloads/mysql/
2. 安装过程
官方文档:
http://dev.mysql.com/doc/refman/5.5/en/linux-installation-rpm.html
rpm -ivh MySQL-server-Version.x86_64.rpm
rpm -ivh MySQL-client-Version.x86_64.rpm
启动mysql
sudo /etc/init.d/mysql start
或者
sudo service mysql start
修改root密码
/usr/bin/mysqladmin -u root password'new-password'
/usr/bin/mysql_secure_installation (推荐)
设置my.cnf
#sudo cp /usr/share/mysql/
my-medium.cnf /etc/my.cnf
#sudo chmod 644 /etc/my.cnf (重要)
3. 错误log分析
问题1:
ERROR 2002 (HY000): Can't connect to localMySQL server through socket '/var/lib/mysql/mysql.sock' (2)
解答:
#sudo service mysql start
问题2:
Warning: World-writable config file '/etc/my.cnf' is ignored
解答:
#sudo chmod 644 /etc/my.cnf
问题3:
表中的字段内容乱码
解答:
在Linux平台,MySQL 5 编辑配置文件/etc/my.cnf,
在[client]后添加:
default-character-set=utf8
在[mysqld]后添加:
default-storage-engine=INNODB
character-set-server=utf8
然后重启MySQL,进入命令行模式验证:
mysql> use mydatabase; mysql> show variables like '%char%';
Reference: