mysql登录不了及修改密码
安装mariadb,默认是无密码的,但一般是指要设置密码的。在设置密码时出现各种问题,可能还是不太明白其原理。
一下我尝试了两种方法,但都失败了。下面这两个是我尝试的方法: 一、网上最多的方法是
1、输入下面的指令
mysqladmin -u root -p password newpassword
但是我已输入提示输入密码,我输入密码了但提示错误,见下
[root@localhost sakila]# mysqladmin -u root -p password newpasswd
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)' 2、停掉数据库服务
systemctl stop mariadb.service
3、对所有的表设置成无密码登陆。
mysqld_safe --skip-grant-tables &
执行完这条语句提示一下错误 [root@localhost sakila]# mysqld_safe --skip-grant-tables &
[1] 14275
[root@localhost sakila]# 150424 10:13:41 mysqld_safe Logging to '/var/log/mariadb/mariadb.l
og'.150424 10:13:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 4、尝试退出数据库,然后重启服务,再进入
[root@localhost sakila]# systemctl restart mariadb.service
[root@localhost sakila]# mysqladmin -u root -p password 'passwd'
Enter password:
mysqladmin:
You cannot use 'password' command as mysqld runs
with grant tables disabled (was started with --skip-grant-tables).
Use: "mysqladmin flush-privileges password '*'" instead 二、正确的操作
1、进到数据库进行操作
[root@localhost etc]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 5.5.41-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> mysql
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds
to your MariaDB server version for the right syntax to use near 'mysql' at line 1MariaDB [(none)]> update user set password=password("123456")where user='root';
ERROR 1046 (3D000): No database selected 2、选择数据库
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed 修改密码
UPDATE user SET authentication_string=PASSWORD('aaaAAA111') WHERE user='root';
FLUSH PRIVILEGES;
mysql登录不了及修改密码的更多相关文章
- (转) mysql的连接,创建账号,修改密码
原文:http://blog.chinaunix.net/uid-20749043-id-1878306.html mysql的连接,创建账号,修改密码 2008-10-13 15:31:29 分类 ...
- MySQL初次安装配置及修改密码
安装前的准备工作: 下载完后,我们将 zip 包解压到相应的目录,这里我将解压后的文件夹放在 C:\mysql-8.0.11 下. 接下来我们需要配置下 MySQL 的配置文件 打开刚刚解压的文件夹 ...
- Django的内置登录、退出、修改密码方法
Django中内置的登录.退出.修改密码方法. 1.url.py中使用django.contrib.auth中的views函数,django.views.generic中的TemplateView函数 ...
- MySQL(版本8.0.19)服务的启动/停止、登录/登出、修改密码
[先说明一点 ,windows系统下,英文字母不分大小写.] MySQL 服务的 启动 / 停止 方式一: (我的系统是windows10) 找到 此电脑 图标 右键点击,选择"管理&q ...
- linux下mysql安装报错及修改密码登录等等
1:下载 [root@localhost soft]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc ...
- Mysql,zip格式安装、修改密码、建库
Mysql,zip格式 1. Mysql 主目录最好别带有"- ."之类的字符 2. Mysql 配置环境变量 Path 环境变量后加上 mysql解压路径:eg:E:\mysql ...
- mysql登录出现1045错误修改方法
在cmd中输入mysql -uroot -p出现1045错误如下: ERROR 1045(28000): Access denied for user 'root'@'localhost'(using ...
- 用java语言写一个简易版本的登录页面,包含用户注册、用户登录、用户注销、修改密码等功能
package com.Summer_0421.cn; import java.util.Arrays; import java.util.Scanner; /** * @author Summer ...
- MySQL 8.0.13安装修改密码的一个问题,记录一下。
https://blog.csdn.net/qq_37350706/article/details/81707862 关于安装MySQL 8.0.13,本人就不多说了,上面这个链接讲的非常详细 请参考 ...
随机推荐
- 关于如何在cenos7.0上实现mysql数据库远程连接
设置mysql允许别的客户机控制的权限 mysql -uroot -p #此处为本地linux帐号密码 select user,host from mysql.user; #查看mysql表对应use ...
- 制作简单的2D物理引擎(零)
最近发现了Github上的开源物理引擎项目Matter.js,对它很感兴趣,发现源码并不算长,算上注释大约1万行左右,值得剖析一番.Matter.js实现一个最小化的2D物理引擎,性能不错,故打算用C ...
- 生活life
1.想办法努力挣钱,而不是如何省钱. 2.再愤怒也不大吼大叫,保持冷静. 3.喜欢的东西自己努力赚钱买. 4.少说多做,能站不坐,适当运动. 5.不要认为找个有钱男人就什么都有了.世界上年轻的女孩子, ...
- 坑备忘error: expected class-name before '{' token
今日重构之前的代码,修改了命名空间,然后一处派生的子类定义处总是总是报error: expected class-name before '{' token,网上查了查原因,出现这种情况大致有两种情况 ...
- guava学习--Preconditions
转载:https://my.oschina.net/realfighter/blog/349819 Preconditions是guava提供的用于进行代码校验的工具类,其中提供了许多重要的静态校验方 ...
- C# Bitmap 复制
以后再详述,先上代码. public bool CopyBitmap(Bitmap source, Bitmap destination) { if ((source.Width != destina ...
- [教训] windows 电脑的垃圾文件清理...
坑你没商量! 这个名叫 “清除系统垃圾.bat“ 的文件在网上传播很广,但是,却出现了错误的版本,如果按照它逐条执行,将导致系统文件夹被一锅端,只能再重装的悲剧! 举个栗子: 错误版本:http:// ...
- PE注入
// PE注入.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <windows.h> #include &l ...
- Cocopods不显示三方库的解决方法
把 $(PODS_ROOT) 的字段添加到 User Header Search Paths 的文件路径下
- 杭电--1102--Constructing Roads--并查集
Constructing Roads Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...