ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'问题的解决



ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 104
这种问题需要强行重新修改密码方法如下:

/etc/init.d/mysql stop   (service mysqld stop )
/usr/bin/mysqld_safe --skip-grant-tables
另外开个SSH连接
[root@localhost ~]# mysql
mysql>use mysql
mysql>update user set password=password("123456") where user="root";
mysql>flush privileges;
mysql>exit





Run your last command using sudo after stopping the mysql service
Code:
sudo service mysql stop
sudo mysqld --skip-grant-tables
The latter wiil, in my experience, not return to a command prompt

In another terminal, start the mysql client and select the mysql database. If the root user entries are still there, just set a password using  update user set password=password('yourpassword') where user='root'.

If there are no root entries, use  grant all privileges on *.* to 'root'@'localhost' identified by 'yourpassword' with grant option.

Next exit the client, find the pid of the running mysql daemon and kill it.

Start the mysql daemon using  sudo service mysql start and try again to get in.

PS you can ignore warnings about lower-test and higher-test.
Last edited by Wim Sturkenboom; September 1st, 2011 at  08:55 AM.

--------------------------------------------------------------------------------

修改连接数:

show variables like 'max_connections';

show global status like 'Max_used_connections';


修改完毕后,重启MySQL即可。当然,为了确保设置正确,应该查看一下max_connections。 

注意: 
1、虽然这里写的32000。但实际MySQL服务器允许的最大连接数16384; 
2、除max_connections外,上述其他配置应该根据你们系统自身需要进行配置,不必拘泥; 
3、添加了最大允许连接数,对系统消耗增加不大。 
4、如果你的mysql用的是my.ini作配置文件,设置类似,但设置的格式要稍作变通。 




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值