1、直接apt-get 安装:
apt-get install mysql-server-5.0
2、安装启动后出现错误信息:(中文)
* Stopping MySQL database server mysqld [ OK ]
安装mysql 时出现下列错误,请教高手!
* Starting MySQL database server mysqld [fail]
invoke-rc.d: initscript mysql, action "start" failed.
dpkg:处理 mysql-server-5.0 (--configure)时出错:
子进程 post-installation script 返回了错误号 1
dpkg:依赖关系问题使得 mysql-server 的配置工作不能继续:
mysql-server 依赖于 mysql-server-5.0;然而:
软件包 mysql-server-5.0 还没有被配置。
dpkg:处理 mysql-server (--configure)时出错:
依赖关系问题 - 仍未被配置
Processing triggers for libc6
ldconfig deferred processing now taking place
在处理时有错误发生:
mysql-server-5.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1) 英文错误信息是:
invoke-rc.d: initscript apparmor, action "force-reload" failed.
* Starting MySQL database server mysqld
fail!
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.0 (--configure):
subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.0; however:
Package mysql-server-5.0 is not configured yet.
dpkg: error processing mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1) 出现错误的原因是我修改了ubuntu的默认网络设置(
/etc/network/interfaces
),删除了ubuntu的
loopback接口,我的解决方法如下:ubuntu原来默认设置:auto lo
iface lo inet loopback
被我修改成静态ip:
auto eth0
iface eth0 inet static
address 10.100.24.31
netmask 255.255.255.0
gateway 10.100.24.254
将上面两部分合起来就可以增加一个Loopback接口
auto eth0
iface eth0 inet static
address 10.100.24.31
netmask 255.255.255.0
gateway 10.100.24.254
auto lo
iface lo inet loopback
重启系统,这时再安装mysql-server就ok了~
3、允许其他机器连接、访问到数据库:
修改文件 /etc/mysql/my.cnf,将
bind-address=127.0.0.1
改为
bind-address=0.0.0.0
这样将允许所有ip访问数据库
参考资料:
http://forum.ubuntu.org.cn/viewtopic.php?p=757703 http://blog.csdn.net/redvalley/archive/2008/04/27/2333702.aspx问题2也可以参考一下
这里的方法,似乎更简单,也不用改动network设置,不过不知可不可以,没验证过~