Mysql 5.6.6 ve üstü sürümlerde komut satırından password girilerek yapılacak girişlerde;
Warning: Using a password on the command line interface can be insecure. Uyarısını alabilirsiniz. Bunun için Mysql5.6.6 sürümüyle birlikte devreye giren mysql_config_editor‘ü kullabilirsiniz.
mysql_config_editor Nedir?
mysql_config_editor (MySQL 5.6.6 ve üstü sürümlerde mevcuttur) kimlik doğrulama bilgilerini clear text olmayacak şekilde root dizininde .mylogin.cnf adında gizli bir dosyada saklamaya olanak sağlar. Dosya MySQL Server’a bağlanırken kimlik doğrulama bilgilerini elde etmek için MySQL istemci programları tarafından okunabilir.
Bu dosyaya login için gerekli, host,user,password,port ve socket bilgilerini set edebiliriz. Aşağıdaki örnekte mysql_config_editor kullanımını görebilirsiniz.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@omeroner~]$mysql_config_editor set --login-path=rootuser --host=localhost --user=root --port=3306 --password Enter password: [root@omeroner~]$mysql --login-path=rootuser Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 53 Server version: 5.6.24-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> |
1 2 |
[root@omeroner~]$ls -l /root/.mylogin.cnf -rw------- 1 root root 268 Apr 22 14:39 .mylogin.cnf |
Bu dosyayı görüntülemek için:
1 2 3 4 5 6 |
root@omeroner~]$ mysql_config_editor print --login-path=rootuser [rootuser] user = root password = ***** host = localhost port = 3306 |
Tüm liste için:
1 2 3 4 5 6 7 8 9 10 |
[root@omeroner~]$mysql_config_editor print --all [root] user = root password = ***** host = localhost [rootuser] user = root password = ***** host = localhost port = 3306 |
Daha fazla bilgi için;
http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html