1.安装MySQL server
首先下载好mysql的rpm安装包
使用rpm命令安装:
rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
命令解释:i:install v:显示详情 h:显示进度条
问题:显示软件安装与本机预装的mysql冲突:
file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.71-1.el6.i686
解决:
1.先找出这个包
rpm -qa | grep mysql
(q:query a:all)
2.使用rpm -e 擦除这个包,但是提示下面的依赖错误
说明别的软件依赖这个包
但是可以采用暴力方式,解除依赖删除:
使用命令:rpm -e mysql-libs-5.1.71-1.el6.i686 –nodepes
重新执行安装MySQL命令:
安装server成功!显示已经成功启动server
2.安装client端
使用命令:
rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm
3.使用命令初始化mysql数据库(用户名和密码设置)
查看安装过程中提醒的信息,主要告诉我们如何初始化数据库:
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h itcast01 password ‘new-password’
Alternatively you can run:
/usr/bin/mysql_secure_installation
输入如下命令初始化mysql:
/usr/bin/mysql_secure_installation
按照提示安装:
Enter current password for root (enter for none):回车
Set root password? [Y/n]输入 Y
New password:输入新的密码
Re-enter new password:再输一遍密码
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
4.使用客户端登录
mysql -uroot -p
输入密码
登录成功!