`
king_tt
  • 浏览: 2108763 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Fedora14安装MySql全过程

 
阅读更多

一、下载MySql

除了yum install mysql mysql-server白痴安装方法外,这次想用rpm包进行安装。进入http://www.mysql.com/downloads/,发现MySql的版本有社区版和商业版,后者是要收费的。一般都用community版。进去后看到标题 “MySQL Community Server 5.6.10”,仔细一看里面要求glibc的版本是glibc 2.5。点右上角的历史版本,选择最旧的5.0.96,Linux-Generic,看到glibc要求版本为2.3.

可以用ls -al /lib/libc.so.6 或者 /lib/libc.so.6来查看系统的glibc的版本。看到版本是2.13,唉,大爷的,不管了。干脆下载最新的:

client版本:

Linux - Generic (glibc 2.5) (x86, 32-bit), RPM Package
Client Utilities

5.6.10

21.8M

Download

(MySQL-client-5.6.10-1.linux_glibc2.5.i386.rpm)

MD5:9a7b25d52cd1ebfa12812bd2e5fb0c58

server版本:

Linux - Generic (glibc 2.5) (x86, 32-bit), RPM Package
MySQL Server
5.6.10 83.8M
(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,输入命令:

[root@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
[root@yan ~]# service mysql restart;

最后是验证:

输入命令:

[root@yan ~]# mysql -uroot -p

【注意这个-p一定要加,否则登陆不上去。】
会提示输入密码,输入密码后即可正常操作数据库了!

一切就绪后可以通过:

[root@yan ~]# netstat -nat | grep 3306
tcp 0 0 :::3306 :::* LISTEN

来查看端口使用情况,默认的就是3306端口。Linux连接MySql有两种方法,分别是socket方式和Tcp/Ip方式。

参考:http://blog.sina.com.cn/s/blog_8442befd01015zld.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics