之前项目中使用的数据库为sqlite,因为它是个本地数据库,不能远程,故研究一下mysql。
记录一下安装过程吧。
主机:centos6.2, x84_64
准备安装的Mysql版本:5.1.72(手头上有一本参考书,先照着来吧)
1. 下载
http://dev.mysql.com/downloads/mysql/5.1.html#downloads
我下载了:
MySQL-client-5.1.72-1.glibc23.x86_64.rpm
MySQL-server-5.1.72-1.glibc23.x86_64.rpm
MySQL-devel-5.1.72-1.glibc23.x86_64.rpm
MySQL-shared-5.1.72-1.glibc23.x86_64.rpm
2. 安装
使用rpm -ivh 依次安装
所幸,没啥问题。
[root@localhost tmp]# rpm -ivh MySQL-server-5.1.72-1.glibc23.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
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 localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
Starting MySQL. SUCCESS!
3. 测试
在命令行中输入: mysql
进入了mysql命令行状态
mysql>
4. 改个密码
mysqladmin -u root password 123456
然后登陆
mysql -u root -p