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

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:
重置密码和数据库(适合源码安装,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
相关文章
|
13天前
|
消息中间件 安全 Unix
SSH配置多台服务器之间的免密登陆以及登陆别名
SSH配置多台服务器之间的免密登陆以及登陆别名
25 1
|
2月前
|
缓存 关系型数据库 MySQL
百度搜索:蓝易云【CentOS8服务器安装MySQL报错:no match mysql-community-server】
现在,你已经成功安装了MySQL服务器并解决了"no match mysql-community-server"的报错问题。祝你使用愉快!
43 1
|
18天前
|
关系型数据库 MySQL 数据库
卸载云服务器上的 MySQL 数据库
卸载云服务器上的 MySQL 数据库
33 0
|
9天前
|
关系型数据库 MySQL 数据安全/隐私保护
MySQL忘记密码后重置密码
MySQL忘记密码后重置密码
4 0
|
13天前
|
关系型数据库 MySQL 数据库连接
Django(四):Django项目部署数据库及服务器配置详解(MySQL)
Django(四):Django项目部署数据库及服务器配置详解(MySQL)
41 11
|
1月前
|
Java 关系型数据库 MySQL
Flink1.18.1和CDC2.4.1 本地没问题 提交任务到服务器 报错java.lang.NoClassDefFoundError: Could not initialize class io.debezium.connector.mysql.MySqlConnectorConfig
【2月更文挑战第33天】Flink1.18.1和CDC2.4.1 本地没问题 提交任务到服务器 报错java.lang.NoClassDefFoundError: Could not initialize class io.debezium.connector.mysql.MySqlConnectorConfig
51 2
|
1月前
|
关系型数据库 MySQL Linux
Linux服务器安装MySQL
Linux服务器安装MySQL
|
1月前
|
关系型数据库 MySQL 数据库
MySQL服务器端安装教程
MySQL服务器端安装教程
34 0
|
2月前
|
Linux
本地下载使用证书登陆的linux服务器的文件的命令
本地下载使用证书登陆的linux服务器的文件的命令

热门文章

最新文章