The normal process of logging in to mysql is generally to execute the following command:
mysql -uroot -p
and then enter the password. In the local linux system, if you want to automatically store the data in the database, it is very inconvenient.
Find the corresponding directory and create a .my.cnf file
If you are a root user, in the /root directory, execute vim .my.cnf
If it is another user, execute vim .my.cnf in the /home/xxx directory.
Fill in the mysql configuration in the .my.cnf file and save it. You can log in directly by using the mysql command again.
[client]
host=localhost
user='root'
password='password'
[mysqldump]
host=localhost
user='root'
password='password'
[client]
host=localhost
user='root'
password='password'
[mysqldump]
host=localhost
user='root'
password='password'