安装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登录不了及修改密码的更多相关文章

  1. (转) mysql的连接,创建账号,修改密码

    原文:http://blog.chinaunix.net/uid-20749043-id-1878306.html  mysql的连接,创建账号,修改密码 2008-10-13 15:31:29 分类 ...

  2. MySQL初次安装配置及修改密码

    安装前的准备工作: 下载完后,我们将 zip 包解压到相应的目录,这里我将解压后的文件夹放在 C:\mysql-8.0.11 下. 接下来我们需要配置下 MySQL 的配置文件 打开刚刚解压的文件夹 ...

  3. Django的内置登录、退出、修改密码方法

    Django中内置的登录.退出.修改密码方法. 1.url.py中使用django.contrib.auth中的views函数,django.views.generic中的TemplateView函数 ...

  4. MySQL(版本8.0.19)服务的启动/停止、登录/登出、修改密码

      [先说明一点 ,windows系统下,英文字母不分大小写.] MySQL 服务的 启动 / 停止 方式一: (我的系统是windows10) 找到 此电脑 图标 右键点击,选择"管理&q ...

  5. linux下mysql安装报错及修改密码登录等等

    1:下载 [root@localhost soft]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc ...

  6. Mysql,zip格式安装、修改密码、建库

    Mysql,zip格式 1. Mysql 主目录最好别带有"- ."之类的字符 2. Mysql 配置环境变量 Path 环境变量后加上 mysql解压路径:eg:E:\mysql ...

  7. mysql登录出现1045错误修改方法

    在cmd中输入mysql -uroot -p出现1045错误如下: ERROR 1045(28000): Access denied for user 'root'@'localhost'(using ...

  8. 用java语言写一个简易版本的登录页面,包含用户注册、用户登录、用户注销、修改密码等功能

    package com.Summer_0421.cn; import java.util.Arrays; import java.util.Scanner; /** * @author Summer ...

  9. MySQL 8.0.13安装修改密码的一个问题,记录一下。

    https://blog.csdn.net/qq_37350706/article/details/81707862 关于安装MySQL 8.0.13,本人就不多说了,上面这个链接讲的非常详细 请参考 ...

随机推荐

  1. .net中excel遇到的一些问题

    Excel.Application app; 错误 1 未能找到类型或命名空间名称“Excel”(是否缺少 using 指令或程序集引用?) 解决方法: 添加引用 Interop.Excel.dll ...

  2. occ 中绘制二维矩形

    在屏幕上绘制一个二级矩形 #include <Visual3d_Layer.hxx> #include <V3d_LayerMgr.hxx> #include <Visu ...

  3. OC — (Foundation框架-NSDate)

    NSDate:是OC中处理日期时间的一个类,可以用来表示时间 获取当前的时间 NSDate *d = [NSDate date]; 创建日期时间对象 NSLog输出是当前时间 格林时间 格式化显示时间 ...

  4. canvas绘图

    1.//获取canvas容器var can = document.getElementById('canvas');//创建一个画布var ctx = can.getContext('2d');2.绘 ...

  5. 在CentOS 6.7中安装NVIDIA GT730显卡驱动的手记

    主机: Dell OptiPlex 390 MT (i5) 系列: 主机原配独显,型号未知,运转三年半,常有异响,关机之后过一阵再开机,可以解决.最近,风扇的声音实在不正常,重启也无解,判定它挂了.风 ...

  6. Shell父进程获取子进程的变量值

    #!/bin/kshshit=""export shitshit=$(su - grid -c 'echo $ORACLE_BASE')pvar=$(subvar="he ...

  7. java 从数据删除指定值

    public class ArrayRemoveValue { public static void main(String[] args) { Integer[] _IntArray = new I ...

  8. bzoj 3172: [Tjoi2013]单词

    #include<cstdio> #include<cstring> #include<iostream> #define M 1000008 using name ...

  9. HDU--杭电--1026--Ignatius and the Princess I--广搜--直接暴力0MS,优先队列的一边站

    别人都是广搜+优先队列,我没空临时学,所以就直接自己暴力了 Ignatius and the Princess I Time Limit: 2000/1000 MS (Java/Others)     ...

  10. regexxx

    var test={ msg:{ "name":"name","value":"value" }}var str=JSO ...