创建mysql用户组和用户
groupadd mysql
useradd -g mysql -d /sbin/nologin mysql
1 下载mysql
http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14-linux-glibc2.5-i686.tar.gz
2 解压mysql
tar zxvf
mysql-5.6.14-linux-glibc2.5-i686.tar.gz
mkdir /usr/local/mysql
mv mysql-5.6.14-linux-glibc2.5-i686/* /usr/local/mysql
3 初始化mysql
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
/usr/local/mysql/scripts/mysql_install_db --user=mysql
注意:出现类似/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
表示缺少包文件,用yum install 安装就OK
4 cp
/usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
添加mysql到服务开机启动
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
service mysqld start
5 添加PATH
vim /etc/profile 在最后,添加: export PATH="/usr/local/mysql/bin:$PATH" 保存,退出,然后运行: #source /etc/profile
6 mysql -u root -p
报错 提示 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (1)
执行 ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
5.补充资料
a.修改密码:
./bin/mysqladmin -u root password 'new-password'
或者用
./bin/mysqladmin -u root -h PE password 'new-password'
b.按照提示一步一步安装的命令:
./bin/mysql_secure_installation