User Tools

Site Tools


mysql:login_without_a_password

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mysql:login_without_a_password [2016/10/13 23:06] – created petermysql:login_without_a_password [2020/07/15 09:30] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== MySQL - Login without a password ====== ====== MySQL - Login without a password ======
  
 +If you wish to setup "root" or any user login without having to supply password on command-prompt, you may create a **.my.cnf** file in your home directory.  MySQL reads this file each time it opens the MySQL client.  Create the **~/.my.cnf** file. 
 +
 +**NOTE**: ~ represents your HOME directory path in Linux.
 +
 +<file mysql .my.cnf>
 +[client]
 +user=root
 +password=root-password
 +host=127.0.0.1
 + 
 +[mysql]
 +database = database-name
 +</file>
 +
 +Be sure to modify the permission of the file to limit access to yourself, so that other users on the system cannot view this file.
 +
 +<code bash>
 +chmod 600 ~/.my.cnf
 +</code>
 +
 +<color red>WARNING</color>: Even with limited file access of the .my.cnf file to yourself, it still posesses security risk as the username and password are stored in clear text form. It is your responsibility to secure your server so that this information is NOT breached. 
  
mysql/login_without_a_password.1476400013.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki