Questions tagged [mysql-cli]
46 questions
4
votes
0 answers
ERROR: Can't initialize batch_readline - may be the input source is a directory or a block device Ubuntu
I am using Ubuntu 20.04 LTS in windows. I am trying to import a previously downloaded database.
When I enter the following I'm prompted for my password:
mysql -u root -p db1 < sampledb.sql
When I enter the password I get the following…

Sashini
- 41
- 2
3
votes
1 answer
Why does --default-character-set=utf8mb4 have no impact on the client connection?
According to https://dev.mysql.com/doc/refman/5.6/en/charset-connection.html, When I connect to a mysql 5.6 server with the mysql 8.0 client using the command:
/usr/bin/mysql -h ${DB_HOST} -u ${DB_USER} -p --default-character-set=utf8mb4
I expect…

Ben Kean
- 182
- 1
- 10
3
votes
0 answers
Prevent MySQL client to save passwords into ~/mysql_history
I use mysql-client 5.55.9999 and I would like to know how to prevent the mysql-client to save passwords to ~/.mysql_history? Let's say, I create a new user:
CREATE USER "username"@"host" IDENTIFIED BY "thePassword";
This statement is being put…

manifestor
- 1,352
- 6
- 19
- 34
2
votes
1 answer
I want the exit code as well as stderr output in powershell
I have code such as this in my linux machine, which I want to port over for windows using powershell:
mysql -udbuser -pPassword -hlocalhost mydb < my_sql_file.sql >> mylog.log 2>&1
if [! $? ]
then
echo "Mysql invocation returned a failure" >>…

gk_2000
- 194
- 3
- 16
2
votes
0 answers
What Does Clear Do?
Being used to Linux I typed clear into MySQL CLI and expected the screen to clear - it did not. But it didn't produce a syntax error or any other kind of notice.
I decided to type any random word into it
MariaDB [db_name] > trey;
This…

treyBake
- 6,440
- 6
- 26
- 57
1
vote
0 answers
MySQL start interactive mode with a script
How can I start mysql interactive mode from the command line, with a list of commands to run one-by-one at different prompts as if I had typed them?
printf "use my_db;\nselect * from my_table;\n" | mysql -u root -p doesn't work, I guess because…

theonlygusti
- 11,032
- 11
- 64
- 119
1
vote
1 answer
MYSQL ignores not null constraint, inserts null values into table and only displays a warning
I am using MYSQL versoin 14.14 Distrib 5.7.40, for Linux (x86_64). I have created a table with 3 columns and the columns have NOT NULL constraints set. Then when I try to insert null values directly into the table, it gives me an error saying the…

Kannan Ramaswamy
- 21
- 5
1
vote
0 answers
Is there an equivalent for \gdesc in mysql?
In postgres, whenever I want to print a description of a query, I could add \gdesc as follows:
# select 1 as num \gdesc
Column | Type
--------+---------
num | integer
(1 row)
I was wondering if there's an equivalent in MySQL (or in any…

Eliya Cohen
- 10,716
- 13
- 59
- 116
1
vote
1 answer
Elapsed query time in MySQL CLI readout
Given a query:
SELECT * FROM users;
Entered into two different MySQL clients, I'm getting radically different elapsed time (or whatever it's called):
1537 rows in set (0.01 sec)
1537 rows in set (0.36 sec)
This mirrors the experience in the (LAMP)…

Jared Farrish
- 48,585
- 17
- 95
- 104
1
vote
3 answers
Mysql:how to change table comment after created already?
How to do it with mysql-cli? table comment means for example foo below:
create table t (c1 int) comment='foo';

user15320797
- 11
- 1
1
vote
1 answer
Google Cloud - Cant connect to MySQL cloud sql instance from GKE using internal IP
I am trying to migrate to use private IP:s for all our Cloud SQL instances. I have gotten it working for postgres, and am now trying to get access for our wordpress instances using MySQL.
The problem is I cant get the connection working from the…

Andreas
- 1,421
- 3
- 16
- 32
1
vote
2 answers
Is it possible to remove the prompt history on MariaDB?
The main problem is that I wrote a security sensitive statement on MariaDB (among many other statements), so I would like to remove the prompt history (like the command history -c on Linux):
jordiba90@lts:~$ sudo mariadb -u root -p
[sudo] contraseña…

jordiba90
- 5
- 1
- 6
1
vote
1 answer
Installing MySQL Client 5.6 on Ubuntu 18.04
I have a legacy project that I'm trying to modernize, and part of that involves setting up a more efficient system of automated backups using mysqldump.
The app's database is using MySQL 5.6, and is hosted via an RDS instance. To get mysqldump up…

Cameron Scott
- 1,276
- 2
- 17
- 37
1
vote
1 answer
How to specify default user in mac OS when running the mysql command in terminal?
I'm on mac OS Catalina 10.15.2 with a fresh install of mysql. I'm getting the following output when running the commands mysql or mysql -v:
ERROR 1045 (28000): Access denied for user 'timothyfisher'@'localhost' (using password: NO)
This is because…

Timothy Fisher
- 1,001
- 10
- 27
1
vote
1 answer
Make mysql client use ALL_PROXY socks5 server
I want to connect to an aurora serverless database from my local machine. Because the database is only accessible from within the aws cloud, I have setup an ec2 instance running microsocks:
./microsocks -p 8888
I now want to connect using mysql…

Dennis
- 1,027
- 1
- 14
- 30