2 emphasis (bold) on now default account named mysql
source | link

However, according to the default documentation 3.4 Securing the Initial MySQL Accounts, there is either the root user or the anonymous account ''(blank/empty).However, according to the default documentation 3.4 Securing the Initial MySQL Accounts, there is either the root user or the anonymous account ''(blank/empty).

Prior 5.7.6:Prior 5.7.6:

5.7.6 and later:5.7.6 and later:

In your example there might be password entries for rootroot and maybe even for anonymous '' (blank). 

If you want to change the password for anonymous then execute the following commands:

However, according to the default documentation 3.4 Securing the Initial MySQL Accounts, there is either the root user or the anonymous account ''(blank/empty).

Prior 5.7.6:

5.7.6 and later:

In your example there might be password entries for root and maybe even for anonymous. If you want to change the password for anonymous then execute the following commands:

However, according to the default documentation 3.4 Securing the Initial MySQL Accounts, there is either the root user or the anonymous account ''(blank/empty).

Prior 5.7.6:

5.7.6 and later:

In your example there might be password entries for root and maybe even for anonymous '' (blank). 

If you want to change the password for anonymous then execute the following commands:

1
source | link

If there is a default MySQL user named mysql then you would start a MySQL prompt with the following command:

shell> mysql -umysql

This would grant you access if the mysql user doesn't have a password. Otherwise you can specify the -p parameter and be prompted for the password:

shell> mysql -umysql -p

However, according to the default documentation 3.4 Securing the Initial MySQL Accounts, there is either the root user or the anonymous account ''(blank/empty).

The mysql.user grant table defines the initial MySQL user accounts and their access privileges. Current versions of MySQL 5.7 create only a 'root'@'localhost' account, but for earlier versions, there might be multiple accounts such as described here:

Some accounts have the user name root. These are superuser accounts that have all privileges and can do anything. If these root accounts have empty passwords, anyone can connect to the MySQL server as root without a password and be granted all privileges.

◾ On Windows, root accounts are created that permit connections from the local host only. Connections can be made by specifying the host name localhost, the IP address 127.0.0.1, or the IPv6 address ::1. If the user selects the Enable root access from remote machines option during installation, the Windows installer creates another root account that permits connections from any host.

◾ On Unix, each root account permits connections from the local host. Connections can be made by specifying the host name localhost, the IP address 127.0.0.1, the IPv6 address ::1, or the actual host name or IP address.

◾ The 'root'@'localhost' account also has a row in the mysql.proxies_priv table that enables granting the PROXY privilege for ''@'', that is, for all users and all hosts. This enables root to set up proxy users, as well as to delegate to other accounts the authority to set up proxy users. See Section 5.9, “Proxy Users”.

• If accounts for anonymous users were created, these have an empty user name. The anonymous accounts have no password, so anyone can use them to connect to the MySQL server.

◾ On Windows, there is one anonymous account that permits connections from the local host. Connections can be made by specifying a host name of localhost.

◾ On Unix, each anonymous account permits connections from the local host. Connections can be made by specifying a host name of localhost for one of the accounts, or the actual host name or IP address for the other.

You can verify the account by executing the following statement on your MySQL instance after connecting with your root account:

Prior 5.7.6:

SELECT User, Host, Password FROM mysql.user;

5.7.6 and later:

SELECT User, Host, HEX(authentication_string) FROM mysql.user;

The following table will be displayed:

+------+--------------------+----------+
| User | Host               | Password |
+------+--------------------+----------+
| root | localhost          |          |
| root | myhost.example.com |          |
| root | 127.0.0.1          |          |
| root | ::1                |          |
|      | localhost          |          |
|      | myhost.example.com |          |
+------+--------------------+----------+

In your example there might be password entries for root and maybe even for anonymous. If you want to change the password for anonymous then execute the following commands:

mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('new_password');

and possibly:

mysql> SET PASSWORD FOR ''@'myhost.example.com' = PASSWORD('new_password');

You should then be able to connect to localhost like this:

shell> mysql -h localhost -pnewpassword

Good luck!