腾讯云主机安装登录mysql失败--解决方案[重置root密码并实现远程连接]
登录MySQL时报错:Access denied for user 'root'@'localhost' (using password: YES)
解决步骤:
1、使用ssh工具连接主机,使用mysqld_safe命令进入安全模式:
Last login: Thu Jun 22 09:56:57 2017 from 182.50.118.228
[root@VM_219_131_centos ~]# service msyqld status
msyqld: unrecognized service
[root@VM_219_131_centos ~]# service mysqld stop
Stopping mysqld: [ OK ]
[root@VM_219_131_centos ~]# service msyqld status
msyqld: unrecognized service
[root@VM_219_131_centos ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[] 4436
[root@VM_219_131_centos ~]# 170622 09:58:15 mysqld_safe Logging to '/var/log/mysqld.log'.
170622 09:58:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170622 10:02:45 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
2、再打开一个窗口,连接MySQL,就可以为root用户设置密码了:
Last login: Thu Jun 22 09:57:25 2017 from 182.50.118.228
[root@VM_219_131_centos ~]# mysql -uroot mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> UPDATE user SET Password=PASSWORD('你的密码') where USER='root' and host='root' or host='localhost';
Query OK, 2 rows affected (0.03 sec)
Rows matched: 2 Changed: 2 Warnings: 0 mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec) mysql> quit
Bye
[root@VM_219_131_centos ~]#
3、打开远程连接权限:
Last login: Thu Jun 22 09:58:24 2017 from 182.50.118.228
[root@VM_219_131_centos ~]# service mysqld status
mysqld (pid 4532) is running...
[root@VM_219_131_centos ~]# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[root@VM_219_131_centos ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec) mysql>
4、使用Navicat工具远程连接,点击左下角的"连接测试",连接成功:

腾讯云主机安装登录mysql失败--解决方案[重置root密码并实现远程连接]的更多相关文章
- Ubuntu腾讯云主机安装分布式memcache服务器,C#中连接云主机进行存储的示例
Ubuntu腾讯云主机安装分布式memcache服务器,C#中连接云主机进行存储的示例(github代码:https://github.com/qq719862911/MemcacheTestDemo ...
- 【转】CentOS6下安装mysql后,重置root密码方法
本文转自:CentOS6下安装mysql后,重置root密码方法 centos下安装mysql,居然不知道root用户密码,本想重装,不过还是先度娘了一些,发现这篇文章,刚好解决我的燃眉之急,太赞了. ...
- 腾讯云ubuntu安装使用MySQL
安装步骤 ubuntu@VM---ubuntu:~$ sudo apt-get install mysql-server (密码: root/root) ubuntu@VM---ubuntu:~$ s ...
- Navicat连接远程主机(腾讯云服务器)的mysql失败,解决
赋予所有用户远程连接的权限,重启mysql即可连接成功: grant all privileges on . to 'root'@'%' identified by 'admin'; systemct ...
- MySql 5.7 重置root密码
一.以安全模式登录 # Stop MySQL sudo service mysql stop # Make MySQL service directory. sudo mkdir -p /var/ru ...
- 腾讯云主机 MySQL 远程访问配置方法
使用腾讯云主机安装 MySQL 之后,需要通过以下步骤进行配置以实现远程访问,主要分为两大部分 一.服务器端口配置 1.如果你的云主机配置了安全组,如果没有配置安全组就可以直接跳过“步骤1”的操作,否 ...
- 访问腾讯云主机mysql的设置问题
---恢复内容开始--- 1.需要打开腾讯云主机的防火墙端口3306,具体实现可以在腾讯云控制台安全组中设置开放全部端口(安全组对应入站.出战规则): 2.将云主机mysql中mysql数据库user ...
- 腾讯云 ubuntuservermysql安装和外网訪问
1 腾讯云 购买ubuntu 默认账户是ubuntu(因为winscp 使用ubuntu没有权限写文件) 因为腾讯云主机ubuntu系统默认username为ubuntu,不喜欢每次做什么都要sudo ...
- 腾讯云-ASP.NET Core+Mysql+Jexus+CDN上云实践
腾讯云-ASP.NET Core+Mysql+Jexus+CDN上云实践.md 开通腾讯云服务器和Mysql 知识点: ASP.NET Core和 Entity Framework Core的使用 L ...
随机推荐
- Solr删除managedschema
一.创建solr核心 solr createcore 二.删除managedschema managedschema是solr自动生成的,里面包含大量无用配置. solr是检查用户定义的schema. ...
- 【RS】Local Latent Space Models for Top- N Recommendation-利用局部隐含空间模型进行Top-N推荐
[论文标题]Local Latent Space Models for Top- N Recommendation (KDD-2018 ) [论文作者]—Evangelia Christakopou ...
- php使用wkhtmltopdf导出pdf
参考:史上最强php生成pdf文件,html转pdf文件方法 http://biostall.com/wkhtmltopdf-add-header-footer-to-only-first-last- ...
- cd及目录快速切换
一.cd ~ 切换到用户目录 二.cd - cd - 返回进入当前目录前所在目录 三.pushd.popd.dirs 在Linux的多目录命令提示符中工作是一种痛苦的事情,但以下这些利用lin ...
- [转]nf_conntrack: table full, dropping packet 连接跟踪表已满,开始丢包 的解决办法
nf_conntrack: table full, dropping packet 连接跟踪表已满,开始丢包 的解决办法 中午业务说机器不能登录,我通过USM管理界面登录单板的时候发现机器没有僵 ...
- Android事件总线还能怎么玩?
作者简介:何红辉,Android工程师,现任职于友盟. 顾名思义,AndroidEventBus是一个Android平台的事件总线框架,它简化了Activity.Fragment.Service等组件 ...
- 【MySQL】mysql中any,in,some,all的区别
子查询就是指在一个select语句中嵌套另一个select语句. any,in,some,all分别是子查询关键词之一, any 可以与=.>.>=.<.<=.<> ...
- 【Linux】分割命令split
如果你有文件太大,导致一些携带式装置无法复制的问题,嘿嘿!找 split 就对了! 他可以帮你将一个大文件,依据文件大小或行数来分割,就可以将大文件分割成为小文件了! 快速又有效啊!真心不错- [ro ...
- Mac OS下Android Studio的Java not found问题,androidfound
Android Studio正式版已经发布一段时间了,使用Mac版的Android Studio可能与遇到Java not found:Android Studio was unable to fin ...
- eclipse插件安装的四种方法
Eclipse插件的安装方法 1.在eclipse的主目录(ECLIPSE_HOME,比如在我的机器上安装的目录是:D:\eclipse)有一个plugins的目录,这种方法的插件安装非常简单,只要将 ...