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

30 excellent examples of color matching in web design

Today, this article has collected 30 excellent cas...

Summary of JavaScript JSON.stringify() usage

Table of contents 1. Usage 1. Basic usage 2. The ...

Solution to Docker image downloading too slowly

Docker image download is stuck or too slow I sear...

Why the CSS attribute value clear:right does not work in detail

Using the clear property to clear floats is a comm...

Example of using the href attribute and onclick event of a tag

The a tag is mainly used to implement page jump, ...

MySQL v5.7.18 decompression version installation detailed tutorial

Download MySQL https://dev.mysql.com/downloads/my...

Detailed explanation of the TARGET attribute of the HTML hyperlink tag A

The hyperlink <a> tag represents a link poin...

Will css loading cause blocking?

Maybe everyone knows that js execution will block...

CSS Skills Collection - Classics among Classics

Remove the dotted box on the link Copy code The co...

Pure CSS to achieve cool neon light effect (with demo)

I have recently been following the CSS Animation ...

Analyzing the node event loop and message queue

Table of contents What is async? Why do we need a...

Detailed tutorial on installing nacos in docker and configuring the database

Environment Preparation Docker environment MySQL ...

How to control the proportion of Flex child elements on the main axis

background Flex layout achieves alignment and spa...

Solution to web page confusion caused by web page FOUC problem

FOUC is Flash of Unstyled Content, abbreviated as ...