{"id":144,"date":"2014-10-14T20:10:19","date_gmt":"2014-10-14T20:10:19","guid":{"rendered":"http:\/\/adrhc.go.ro\/wordpress\/?p=144"},"modified":"2019-04-01T19:14:15","modified_gmt":"2019-04-01T17:14:15","slug":"mysql-command-line","status":"publish","type":"post","link":"https:\/\/adrhc.go.ro\/blog\/mysql-command-line\/","title":{"rendered":"Mysql command line"},"content":{"rendered":"<pre class=\"brush:bash shell\">\r\n# connecting to exifweb database:\r\nmysql -u exifweb -p\r\nuse exifweb\r\ninsert into AppConfig values (null, 'false', 'cpu summary: use sum on ps aux command', now());\r\nexit or CTRL+D\r\n\r\n# https:\/\/dev.mysql.com\/doc\/mysql-utilities\/1.6\/en\/mysql-utils-intro-connspec-mylogin.cnf.html\r\n# avoid warning for commands like:\r\nmysql -u root -pmysqlpassword -e 'FLUSH QUERY CACHE'\r\n\r\n# see \/etc\/mysql\/mysql.conf.d\/mysqld.cnf for --socket\r\n# see $HOME\/.mylogin.cnf\r\nmysql_config_editor set --login-path=local --host=127.0.0.1 --user=root --socket=\/var\/run\/mysqld\/mysqld.sock --password\r\n# or using the --port option:\r\nmysql_config_editor set --login-path=local --host=127.0.0.1 --user=root --port=3306 --password\r\nmysql_config_editor print --login-path=local\r\n\r\n# The result of the command below:\r\nmysqlserverinfo --server=local --format=vertical\r\n# is strange: \r\n# ERROR: Access denied for user 'root'@'127.0.0.1' using password: YES\r\n\r\n# the below command works fine so I guess mysqlserverinfo don't work well with mysql_config_editor\r\nmysqlserverinfo --server=root:xxx@127.0.0.1 --format=vertical\r\n\r\n# remove with:\r\nmysql_config_editor remove --login-path=local\r\n\r\n# now you have no warnings:\r\nmysql --login-path=local -e 'FLUSH QUERY CACHE'\r\n\r\n# other example, e.g. connect to db1 then show tables:\r\nmysql --login-path=local db1\r\nshow tables;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p># connecting to exifweb database: mysql -u exifweb -p use exifweb insert into AppConfig values (null, &#8216;false&#8217;, &#8216;cpu summary: use sum on ps aux command&#8217;, now()); exit or CTRL+D # https:\/\/dev.mysql.com\/doc\/mysql-utilities\/1.6\/en\/mysql-utils-intro-connspec-mylogin.cnf.html # avoid warning for commands like: mysql -u root [&hellip;]<\/p>\n<div class=\"link-more\"><a href=\"https:\/\/adrhc.go.ro\/blog\/mysql-command-line\/#more-144\" class=\"more-link\">Continue reading &#10142; <span class=\"screen-reader-text\">Mysql command line<\/span><\/a><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,12,159],"tags":[],"class_list":["post-144","post","type-post","status-publish","format-standard","hentry","category-commands","category-database","category-mysql"],"_links":{"self":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":0,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"wp:attachment":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}