Comments on: How to Run MySQL/MariaDB Queries Directly from the Linux Command Line https://www.tecmint.com/run-execute-mysql-mariadb-queries-directly-linux-commandline/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Fri, 14 Jul 2023 01:19:37 +0000 hourly 1 By: Bernt B https://www.tecmint.com/run-execute-mysql-mariadb-queries-directly-linux-commandline/comment-page-1/#comment-865919 Thu, 09 Feb 2017 14:12:14 +0000 http://www.tecmint.com/?p=22336#comment-865919 Search for how to use the mysql_config_editor command. It stores the data encrypted.

You set it up with:

# mysql_config_editor set --login-path=myserver --host=dbserver.foo.com --user=adam -p

Then you can do:

alias sqlcmd='mysql --login-path=myserver  -Dmydbname  --execute'

And finally:

sqlcmd 'DESC table'
]]>
By: LempStacker https://www.tecmint.com/run-execute-mysql-mariadb-queries-directly-linux-commandline/comment-page-1/#comment-810572 Mon, 29 Aug 2016 01:15:04 +0000 http://www.tecmint.com/?p=22336#comment-810572 Maybe we can create a file name ‘.my.cnf’ under user home directory, add mysql user, password in it, like this
[client]
user=USERNAME
password=USERPASSWD

then change its mode as 600, so we can use command ‘mysql’ directly without set parameter ‘-p’, and password prompt would not appear.

]]>
By: Tom-Erik Paulsen https://www.tecmint.com/run-execute-mysql-mariadb-queries-directly-linux-commandline/comment-page-1/#comment-808932 Mon, 22 Aug 2016 21:59:37 +0000 http://www.tecmint.com/?p=22336#comment-808932 Wow , someone should make a tutorial on how to make a READ ONLY user for that tutorial. Even if the password is prompted, newcomers would easily add the root password to a script and pat themselves on the back.

]]>