
You may also like to read these related articles about MySQL/MariaDB: Run Mysql- Commands Without Root Password Once you have set user and password in the Mysql configuration file, from now on when you run mysql commands such as mysql, mysqladmin etc, they will read the mysqluser and mysqlpasswd from the above file. Then set the suitable permissions on it, to make it only readable and writable by you. Now create the config file ~/.my.cnf and add configurations below in it (remember to replace mysqluser and mysqlpasswd with your own values). To run MySQL commands without entering password on the terminal, you can store your user and password in the ~/.my.cnf user specific configuration file in user’s home directory as described below.
#Sql server on mac setting root user and password how to
# mysqladmin -u root password YOURNEWPASSWORD How to Connect or Run MySQL Without Root Password Note that this command is just one of the many MySQL (Mysqladmin) Commands for Database Administration in Linux. To secure it, set the MySQL/MariaDB password for root user with the following command. In case you have freshly installed the MySQL/MariaDB server, then it doesn’t require any password to connect to it as root user.

In this guide, we will show you how to connect and run MySQL commands without entering a password (mysql passwordless root login) on the Linux terminal.


Suggested Read: How to Install and Secure MariaDB 10 in CentOS 7 Normally while installing MySQL/MariaDB database server on Linux, it’s recommended to set a MySQL root user password to secure it, and this password is required to access the database server with root user privileges.
