安装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. H5如何实现一行三列布局

    <!DOCTYPE html><html lang="en"><head>         <meta charset="UTF ...

  2. Nginx+php+fastcgi在win7下的配置

    首先装载php 1.从www.php.net上下载php对应版本 2.解压之后放到c盘下(其实放哪无所谓,Apache会有配置指向,但是Nginx不用) 3.因为用的5.3.17版本,已经有了php- ...

  3. tfs中如何创建团队项目及如何操作团队项目

    创建团队项目集合 tfs server管理控制台\团队项目集合页面.选择'创建集合'链接,按向导即可创建项目集合. 创建团队项目 创建好团队项目集合后,就要开始创建团队项目了. 进入vs,连接上tfs ...

  4. Ext4 ComboBox组件使用

     先来看例子: Ext.define('schoolModel', { extend: 'Ext.data.Model', fields: [{ name: 'id', type: 'string' ...

  5. 【小月博客】 Html5 上传图片 移动端、PC端通用

    在博客园注册账号有些天了,感觉有些许欣慰,自己写的东西有人在看,有人在评论很是开心.(ps: 满足一下虚荣心吧!) 废话不多说了,说一下今天给大家分享的是 html5上传图片.我们是在移动端使用的,但 ...

  6. Visro 应用的前端模板工具介绍 -JsRender

    1.什么是JsRender: JsRender是一款JavaScript模版引擎,是具有简单直观,功能强大,可扩展的,早期版本是基于JQUERY 写的,后来作者重构了,就不再依赖JQUERY了. 它的 ...

  7. Github——入门笔记

    一般操作步骤 developer:(你在别人基础上开发) init->clone->add->commit->remote add(origin的地址)->push or ...

  8. MFC-01-Chapter01:Hello,MFC---1.2 MFC简介

    1.2 MFC简介 MFC是Microsoft提供的放置Windows API的面向对象的包装的C++类库.MFC大约封装了好几百个类,其中有一些可以直接调用,有些类可以作为用户自己的类的基类.一些M ...

  9. 在mac上获取iphone当前屏幕截图

    xcode->windows->devices->take screenshot ![](http://o9etp0h70.bkt.clouddn.com/16-9-6/145261 ...

  10. 在非spring组件中注入spring bean

    1.在spring中配置如下<context:spring-configured/>     <context:load-time-weaver aspectj-weaving=&q ...