Mysql anonymous login cannot create a database problem solution

Mysql anonymous login cannot create a database problem solution

Frequently asked questions

Access denied for user ''@'localhost' to database 'web02' //web02 is a database I created myself

Cause analysis: In the user table of the MySQL database, there is an account with an empty username, that is, an anonymous account. As a result, although the login is done as root, it is actually an anonymous login.

Below is a comparison of the two login methods

1)mysql -u root -p

It can be seen that this most primitive method is not safe, and the system does not know whether the user is anonymous.

2)mysql -hlocalhost -uroot -p

-h represents the server name, localhost represents the local; -u represents the database user name, root is the default user name of MySQL; -p represents the password. If a password is set, you can directly enter it after -p, such as: -p123456. If the user has not set a password, just press Enter when Enter password is displayed.

This method of entering the database can quickly resolve the problem.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to create a MySQL database and support Chinese characters
  • Introduction to adding new users to MySql, creating databases for users, and assigning permissions to users
  • mysql create database, add users, user authorization practical method
  • Two ways to create a MySQL database
  • Create database and database table code with MySQL
  • Example of creating a database using PHP
  • Create database php code and write your own BLOG system with PHP
  • PHP Desktop Center (I) Creating a database
  • MySQL and PHP basics and application topics: creating database tables

<<:  HTML+VUE paging to achieve cool IoT large screen function

>>:  harborRestart operation after modifying the configuration file

Recommend

A brief discussion on MySQL user permission table

MySQL will automatically create a database named ...

MYSQL performance analyzer EXPLAIN usage example analysis

This article uses an example to illustrate the us...

How to change the domestic source of Ubuntu 20.04 apt

UPD 2020.2.26 Currently Ubuntu 20.04 LTS has not ...

Vue realizes cascading selection of provinces, cities and districts

Recently, I need to implement a cascading selecti...

HTML head tag detailed introduction

There are many tags and elements in the HTML head ...

Tutorial on how to remotely connect to MySQL database under Linux system

Preface I recently encountered this requirement a...

WeChat applet implements calculator function

This article shares the specific code for the WeC...

Graphical explanation of the solutions for front-end processing of small icons

Preface Before starting this article, let’s do a ...

Vue uses custom instructions to add watermarks to the bottom of the page

Project Scenario Add a custom watermark to the en...

How to modify the default network segment of Docker0 bridge in Docker

1. Background When the Docker service is started,...

Solution to the problem that elements with negative z-index cannot be clicked

I was working on a pop-up ad recently. Since the d...

How to Monitor Linux Memory Usage Using Bash Script

Preface There are many open source monitoring too...

Several methods of implementing carousel images in JS

Carousel The main idea is: In the large container...

The implementation process of extracting oracle data to mysql database

In the migration of Oracle database to MySQL data...

JavaScript lazy loading detailed explanation

Table of contents Lazy Loading CSS styles: HTML p...