Linux - Generic (glibc 2.5) (x86, 32-bit), RPM Package
MySQL Server
5.6.10
83.8M
Download
(MySQL-server-5.6.10-1.linux_glibc2.5.i386.rpm)
MD5:de984e59aa502e38e55cea77cbf898d0
注意链接里的devel版本,是需要在c语言或c++调用处理数据库的接口时,下载的安装包。
将文件拷贝到/mnt/yan/download后,分别调用rpm -ivh “xxxxxxx.rpm”进行安装。
安装完成后,在root下,输入service mysql start,然后进行登录,可奇怪的是初始密码是多少?? 有人说是空,即什么都不写,无论用mysql 还是mysqladmin登录,依然出错:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
也有人说修改/etc/my.cnf文件,但是用rpm安装的是没有这个文件的,参考:http://blog.csdn.net/e3399/article/details/7569646
绕了好大一圈子得到的解决办法: 1,手先停止mysql服务:service mysqld stop
2,输入命令:
[iyunv@yan ~]# mysqld_safe --skip-grant-tables & mysql -uroot -p 【注意,这是一个完整的命令,不能从&拆成两个!】
得到的结果是:
[1] 3970
Enter password: 130319 22:46:50 mysqld_safe Logging to '/var/lib/mysql/yan.guoqi.err'.
130319 22:46:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
3,输入命令:
mysql> use mysql;
4,mysql> update user set password=PASSWORD("yanguoqi")where user="root";
【注意:“”里面的是你要设的密码!!!!】
5,输入:
mysql> flush privileges;
6,退出并重启数据库。输入:
mysql> quit;
Bye
[iyunv@yan ~]# service mysql restart;
最后是验证:
输入命令:
[iyunv@yan ~]# mysql -uroot -p 【注意这个-p一定要加,否则登陆不上去。】 会提示输入密码,输入密码后即可正常操作数据库了!