mg4377娱乐娱城官网_mg4377娱乐手机版_www.mg4377.com

当前位置: mg4377娱乐娱城官网 > mg > 正文

不可能三翻五次数据库

时间:2019-07-07 00:46来源:mg
测试的php文件 ?php $link=mysql_connect('localhost','root','zz') or die(mysql_error()); mysql_select_db('test') or die('no db'); mysql_query('SET NAMES utf8'); echo 99; ? 运转后报错 Can't connect to local MySQL server through socke

测试的php文件
<?php
$link=mysql_connect('localhost','root','zz') or die(mysql_error());
mysql_select_db('test') or die('no db');
mysql_query('SET NAMES utf8');
echo 99;
?>
运转后报错
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
但在 命令行中能步入mysql
[[email protected] local]# mysql -u root -p
不可能三翻五次数据库。Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 3Server version: 5.5.2-m2 Source distribution
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
化解办法
chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R root /usr/local/mysql/bin
chgrp -R mysql /usr/local/mysql/bin
chgrp -R mysql /var/lib/mysql
chmod 777 /var/lib/mysql
chown -R root /var/lib/mysql/mysql
chgrp -R mysql /var/lib/mysql/mysql
chmod 777 /var/lib/mysql/mysql
chown -R root /var/lib/mysql/mysql/*
chgrp -R mysql /var/lib/mysql/mysql/*
chmod 777 /var/lib/mysql/mysql/*
chmod 777 /usr/local/mysql/lib/mysql/libmysqlclient.a

先天服务器蒙受了二个很熟谙的标题输入#mysql -u root -pE智跑RO奥迪Q3 二零零四 (HY000):Can't connect to local MySQL server随即上网搜索答案依照我们提供的方法本人逐条尝试
方案1.
1.#ps -A|grep mysql 彰显类似:1829 ? 00:00:00 mysqld_safe
1876 ? 00:00:31 mysqld
2.#kill -9 1829
3.#kill -9 1876
4.#/etc/init.d/mysql restart
5.#mysql -u root -p 他的劳动消除了,小编的还没消除!
持续找方案2
先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是或不是已经起步.

开始django 从前 假若项目三番五次过mysql 须求手动运维mysq

编辑:mg 本文来源:不可能三翻五次数据库

关键词: Python