当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > fedora8 下mysql 安装的安装方法

Unix/Linux
Linux管理员手册(4)--内存管理
开始进入Linux的知识问答
TCP/IP基础----为Linux做准备(1)
怎样用linux拨号上网
Linux 下文件的压缩、打包与解开
Linux操作系统下的浏览器举要
Linux中的字型(FONTS)设定
用FIPS为LINUX分区
Squid -- Linux下的一个优秀代理服务器软件使用详解
基于Linux的目录服务实现
动手制做自己的Linux启动盘(1)
如何为Linux添加软件详解
LINUX的引导过程
关于Linux下编写和编译程序的几个问题
中文BluePoint Linux 1.0RC 版安装介绍(二)
怎样让你的Linux使用起来更像Windows
Linux下无线上网设置方法
Linux系统下架设CS服务器的完美方法
优化Linux系统硬盘的七个实用技巧
在Linux操作系统中如何截获系统调用

Unix/Linux 中的 fedora8 下mysql 安装的安装方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-15   浏览: 60 ::
收藏到网摘: n/a

我下载的是目前最新的版本mysql-5.0.45-linux-i686.tar.gz
  安装过程:
    su 到root 权限。
  #tar -zvxf mysql-5.0.45-linux-i686.tar.gz
  #mv mysql-5.0.45/ /usr/local/mysql
  #cd /usr/local/mysql
  #groupadd mysql
  #useradd -g mysql mysql
  #chown -R mysql .
  #chgrp -R mysql .
  #scripts/mysql_install_db --user=mysql
  #chown -R root .
  #chown -R mysql data
  #bin/mysqld_safe --user=mysql &
  按照官方文档说这就应该能启动了,可是报错如下:
  
  
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
071112 00:22:06  mysqld ended


查看日志:

#less /var/log/mysqld.log
其中有一段如下:
071112  0:22:06 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)
071112  0:22:06 [ERROR] Can't start server: can't create PID file: No such file or directory
071112 00:22:06  mysqld ended

#cd /var/run/
#ls
mysqld目录不存在
#mkdir /var/run/mysqld
#cd /var/run/mysqld
创建文件mysqld.pid
#touch mysqld.pid
#cd..
#chown -R mysql mysqld .

#cd /usr/local/mysql/
#bin/mysqld_safe --user=mysql &
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql

能正常启动

#bin/mysqladmin -u root password root

又出错

[root@localhost mysql]# bin/mysqladmin -u root password root
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!


[root@localhost mysql]# bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

分析:是/tmp/mysql.sock 不存在
# cd /var/lib/mysql/
ibdata1      ib_logfile0  ib_logfile1  mysql/       mysql.sock   test/
由于mysql 默认的mysql.sock 是在/var/lib/mysql/mysql.sock,

创建符号连接:
# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
# bin/mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

修改root 密码
#cd /usr/local/mysql/
#bin/mysqladmin -u root -p password yourpassword

一切ok.
一切ok...