解决远程无法登陆mysql服务器的问题和重置密码

简介:
+关注继续查看
重置密码和数据库(适合源码安装,rpm的可能不行)
 
[root@mail postfixadmin]# /usr/bin/mysql_install_db --force
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h mail.test.com password 'new-password'
See the manual for more instructions.
NOTE:  If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
[url]http://www.mysql.com[/url]
Support MySQL by buying support/licenses at [url]http://shop.mysql.com[/url]
 
2. cp support-files/mysql.server /etc/init.d/mysql(源码路径)
3 ./usr/bin/mysqld_safe &
4./etc/init.d/mysql start

5 mysqladmin -u root password "new password"
 
解决root关于本机登陆可以,远程同样密码帐户无法用mysql administrator连接
 
在使用MySQL-Front连接mysql的时候发生的这个错误
ERROR 1130: Host 192.168.88.160 is not allowed to connect to this MySQL server
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称”%”
mysql -u root -p
mysql>use mysql;
mysql>update user set host = ‘%’  where user =’root’;
mysql>flush privileges;
mysql>select ‘host’,'user’ from user where user=’root’;
现在就可以连接了!
2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO‘myuser’@'%’IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON *.* TO‘myuser’@'192.168.1.3′IDENTIFIED BY ‘mypassword’ WITH
 
 本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/112959
 

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
2天前
|
关系型数据库 MySQL
3.3.2 【MySQL】客户端和服务器通信中的字符集
3.3.2 【MySQL】客户端和服务器通信中的字符集
5 0
|
2天前
|
关系型数据库 MySQL 数据库
【Navicat 连接MySQL时出现错误1251:客户端不支持服务器请求的身份验证协议;请考虑升级MySQL客户端】
【Navicat 连接MySQL时出现错误1251:客户端不支持服务器请求的身份验证协议;请考虑升级MySQL客户端】
|
9天前
|
SQL 关系型数据库 MySQL
服务器意外断电MySQL无法启动
服务器意外断电MySQL无法启动
|
1月前
|
关系型数据库 MySQL Linux
centos服务器下面安装mysql
centos服务器下面安装mysql
37 0
|
1月前
|
缓存 Ubuntu 关系型数据库
在 Ubuntu 中如何完全卸载 MySQL 服务器?
在 Ubuntu 中如何完全卸载 MySQL 服务器?
43 1
|
1月前
|
关系型数据库 MySQL 数据库
MySQL “ 服务器无法启动,没有报任何错误 ”的解决方法
MySQL “ 服务器无法启动,没有报任何错误 ”的解决方法
MySQL “ 服务器无法启动,没有报任何错误 ”的解决方法
|
1月前
|
开发工具
VIM一些常用命令(一)
VIM一些常用命令(一)
|
2月前
|
关系型数据库 MySQL
创建mysql账户且指定服务器访问
创建mysql账户且指定服务器访问
|
2月前
|
关系型数据库 MySQL PHP
PHP MySQL连接服务器
PHP MySQL连接服务器
|
2月前
|
网络协议 关系型数据库 MySQL
云端服务器(linux版)部署mysql
云端服务器(linux版)部署mysql
96 0
推荐文章
更多