Rumah > Artikel > pangkalan data > Ubuntu下安装MySQL后MySQL SERVER不能启动的解决
Ubuntu下安装MySQL数据库步骤:1.下载mysql-6.0.4-alpha.tar.gz2.tar -zxvf mysql-6.0.4-alpha.tar.gz3.cd mysql-6.0.4-alpha4../
Ubuntu下安装MySQL数据库步骤:
1.下载mysql-6.0.4-alpha.tar.gz
2.tar -zxvf mysql-6.0.4-alpha.tar.gz
3.cd mysql-6.0.4-alpha
4../configure --prefix=/usr/local/mysql
5.make
6.sudo make install
7.sudo cp supported-files/my-medium.cnf /etc/my.cnf
8.sudo cp supported-files/mysql.server /etc/init.d
9.sudo chmod a+x /etc/ini.d/mysql.server
10.cd /usr/local/mysql
11.bin/mysql_install_db --user=mysql
到这里,mysql基本安装完毕,然后就要启动mysql了.
先试试mysqld_safe可以不:
1.bin/mysqld_safe &
2.ps -ef | grep mysql
可以查到mysql的进程,ok,kill掉mysql的进程
现在试试以服务的方式启动mysql:
1./etc/init.d/mysql.server
报错了:Starting MySQL../etc/init.d/mysql: line 159: kill: (6638) - No such process
于是sudo vi /etc/init.d/mysql.server,查找到启动mysql的脚本,在大约307行左右.把变量打印出来.
然后手工执行启动mysql的命令:bin/mysqld_safe --datadir=/usr/local/mysql/var/ --pid-file=/usr/local/mysql/var/mysql.pid
发现启动mysql错误,报permission deny.于是怀疑是用户权限问题导致/usr/mysql/var/mysql.pid文件无法创建.
再重新执行上面的命令:sudo bin/mysqld_safe --datadir=/usr/local/mysql/var/ --pid-file=/usr/local/mysql/var/mysql.pid
至此真相大白!在手工执行/etc/init.d/mysql.server时,也要记得"sudo".
,