Home Database Mysql Tutorial 首次使用MySQL报错error1045

首次使用MySQL报错error1045

Jun 07, 2016 pm 05:34 PM
mysql error

刚学了mysql准备在自己的虚拟机上回家玩玩,结果mysql就立马给我一个下马威,拒绝连接root用户,首先呢,我耐心的在网上寻找解决

前提唠叨:

刚学了mysql准备在自己的虚拟机上回家玩玩,结果mysql就立马给我一个下马威,拒绝连接root用户,首先呢,我耐心的在网上寻找解决之道,确实发现很多,但归纳起来也就三四种,再折腾了2个多小时挨个试完之后发现,没有一个可以解决我这个问题。过了两天碰到老师我向他咨询了一下,结果回来立马就解决了!牛!

再啰嗦两句,首先你得是跟我相似或者一样的应用环境,这个很重要,不同的环境下结果可能呈现万般不同;然后呢,我这是只是快速的解决进入mysql的问题,至于进去之后你要不要再添设密码以加强安全什么的不在今天所说之列,闲话稍许,下面是正题。

环境:RedHat企业版5.9
用户:root
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
1、这时我想那我添设个初始密码呗!话说初始化之后应该是可以匿名进入的才对啊!
[root@localhost ~]# mysqladmin -hlocalhost -uroot password"123"
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
2、设置失败,既然这样我只能试一试老师说到的mysql的配置文件
[root@localhost ~]# vim /etc/my.cnf
[mysqld]
skip-grant-table        //这句表达的意思呢是“跳过授权表,即无密码直接进入啦”
3、重启服务
[root@localhost ~]# service mysqld restart
停止 mysqld:                                              [确定]
启动 mysqld:                                              [确定]
4、再次进入
[root@localhost ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, 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>

嘿嘿,终于看到这个向右的小箭头了!

虽然简单,但若能帮到某人,,我会很开心的。

更多相关阅读:

MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'

解决MySQL安装时1045错误的方法

Linux下MySQL远程连接提示ERROR 1045 (28000)

MySQL出现1045错误服务找不到路径的解决

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Duplicate entry for key 'PRIMARY' - How to solve MySQL error: Duplicate record of primary key Duplicate entry for key 'PRIMARY' - How to solve MySQL error: Duplicate record of primary key Oct 05, 2023 pm 02:49 PM

How to solve MySQL error: Duplicate primary key records, specific code examples are needed. When using MySQL database, we often encounter the problem of duplicate primary key records. When we insert a new piece of data into the database, if the primary key value of the data is the same as the primary key value of an existing record, a duplicate primary key record error will occur. The prompt for this error is usually "Duplicatetryforkey'PRIMARY'". So, how to solve this problem? This article will provide several solutions

Table 'table_name' already exists - How to solve MySQL error: table already exists Table 'table_name' already exists - How to solve MySQL error: table already exists Oct 05, 2023 am 09:25 AM

Table'table_name'alreadyexists-How to solve MySQL error: The table already exists, specific code examples are needed. Introduction: During the development and management process of using MySQL database, you often encounter errors that the table already exists. This error usually occurs when creating a table repeatedly or when importing an existing table structure. This article will introduce how to solve the problem of MySQL error: table already exists, and provide specific code examples. 1. What is MySQL error: Table has been

Cannot add or update a child row: a foreign key constraint fails - How to solve MySQL error: child row has foreign key constraint Cannot add or update a child row: a foreign key constraint fails - How to solve MySQL error: child row has foreign key constraint Oct 05, 2023 am 08:22 AM

How to solve the MySQL error: The child row has foreign key constraints, specific code examples are needed. When using the MySQL database, we may encounter the error "Cannotaddorupdateachildrow:aforeignkeyconstraintfails". This error usually indicates a foreign key constraint problem when inserting or updating data. This article explains how to solve this problem and provides specific code examples. First, let's deal with

Data too long for column 'column_name' - How to solve MySQL error: data exceeds field length Data too long for column 'column_name' - How to solve MySQL error: data exceeds field length Oct 05, 2023 am 08:29 AM

How to solve MySQL error: The data exceeds the field length, specific code examples are needed. During the development process of using MySQL database, we often encounter the problem that the data exceeds the field length. When we insert or update data, if the length of the data exceeds the defined length of the field, MySQL will report an error and prevent the data insertion or update operation. The common prompt message for this kind of error is: Datatoolongforcolumn'column_name'. it tells us a certain field

Can't connect to local MySQL server through socket 'socket_name' (2) - How to solve the MySQL error: Can't connect to the local MySQL server through socket (2) Can't connect to local MySQL server through socket 'socket_name' (2) - How to solve the MySQL error: Can't connect to the local MySQL server through socket (2) Oct 05, 2023 am 09:18 AM

Can'tconnecttolocalMySQLserverthroughsocket'socket_name'(2)-How to solve MySQL error: Unable to connect to the local MySQL server through socket (2), specific code examples are needed When developing and managing MySQL databases, sometimes we encounter some problems, One of the common problems is the inability to connect to the local MySQL server via socket. when we taste

Duplicate entry 'value' for key 'unique_key_constraint' - How to solve MySQL error: Duplicate records in unique key constraints Duplicate entry 'value' for key 'unique_key_constraint' - How to solve MySQL error: Duplicate records in unique key constraints Oct 05, 2023 am 09:57 AM

How to solve the MySQL error: Duplicate records in unique key constraints, specific code examples are needed. When using the MySQL database, we often encounter an error, that is, the error: "Duplicateentry'value'forkey'unique_key_constraint'". This error is usually caused by a unique key constraint being violated when inserting or updating data, resulting in duplicate records in the database. Unique key constraints can ensure that a certain field in the database

Unknown column 'column_name' in 'table_name' - How to solve MySQL error: unknown column name in table Unknown column 'column_name' in 'table_name' - How to solve MySQL error: unknown column name in table Oct 05, 2023 pm 02:18 PM

Unknowncolumn'column_name'in'table_name'-How to solve MySQL error: Unknown column name in table, specific code example is needed. When using MySQL database, sometimes you will encounter such error message: Unknowncolumn'column_name'in'table_name'(table Unknown column name in ). This error is usually caused by the specified column name not existing in the table. In this article

Unknown column type 'column_type' in column 'column_name' - How to solve MySQL error: Unknown column type in column Unknown column type 'column_type' in column 'column_name' - How to solve MySQL error: Unknown column type in column Oct 05, 2023 pm 02:28 PM

Title: How to solve MySQL error: Unknown column type in column, specific code example is required Introduction: Database plays an important role in the application development process, and MySQL, as one of the commonly used relational database management systems, is widely used In various web applications and enterprise-level systems. However, in the process of using MySQL to create tables, you sometimes encounter error messages. One of the common errors is "Unknowncolumntype'column_type'in

See all articles