Skip to main content
36 votes
Accepted

Why does piping `mysql` to 'tail' change the output format?

It's not tail, it's the piping. mysql uses a tabular with ASCII boxing output format when its stdout is a terminal device, when it's intended for a user, and reverts to a scripting format when it's ...
Stéphane Chazelas's user avatar
24 votes

install mysql - has no installation candidate

sudo apt install mariadb-server
Engineering Team's user avatar
24 votes
Accepted

What are dbgsym packages?

The dbgsym package contains debug symbols. TLDR Ignore the dbgsym package Details If your program (mysql in this case) is written in a compiled language such as C, C++, Go, Rust, etc and converted ...
icarus's user avatar
  • 19.1k
17 votes

Ubuntu 18.04 LTS: Problem with dependencies installing MySQL 8.0 server

This fixed it for me (MySQL 8.0 - Ubuntu 20.04) sudo apt-get purge mysql\* libmysql\* sudo apt autoremove But the package "mysql-client-core-8.0" don't uninstall, so... sudo apt --fix-...
Cesar Devesa's user avatar
16 votes

install mysql - has no installation candidate

If you navigate the http://repo.mysql.com/apt/debian/pool/ repo, you'll find various versions available. It looks like mysql-server-5.6 was a metapackage, which is not there any longer. However, to ...
Lizardx's user avatar
  • 3,134
15 votes
Accepted

Debian 9: After upgrade from 8, MySQL (MariaDB) does no longer work

For some reason you don't have the file /etc/mysql/debian-start, which is the error given: 16:55:25 doraemoe systemd[6859]: mariadb.service: Failed at step EXEC spawning /etc/mysql/debian-start: No ...
wurtel's user avatar
  • 16.5k
14 votes

How to pass password to mysql command line

create a file ~/.my.cnf, make it only accessible by yourself, permission 600. [client] user=myuser password=mypassword Then you don't need type password any more. bash$ mysql -u myuser ...
oldpride's user avatar
  • 251
14 votes
Accepted

How do I capture a MySQL result set in a bash array?

With the --batch option, mysql should output the result one record on a line, and columns separated by tabs. You can read the lines to an array with Bash's mapfile and process substitution, or command ...
ilkkachu's user avatar
  • 148k
11 votes

How to pass password to mysql command line

You can use a nifty Linux trick... /dev/stdin can be used as a file resource for --defaults-file like so: echo -e "[client]\nuser=xxx\npassword=xxx" | mysql --defaults-file=/dev/stdin -e '...
Danny Kopping's user avatar
11 votes

error processing package mysql-community-server during apt-get upgrade

It looks as though the installation was interrupted in an earlier session. Try sudo apt-get install -f to see if it will fix broken dependencies. If that fails, purge MySQL server: sudo apt-get ...
gracious1's user avatar
  • 639
10 votes

Install libmysqlclient on CentOs 7

Try yum install mariadb-devel for CentOS 7
Eranga Atugoda's user avatar
10 votes

What are dbgsym packages?

dbgsym stands for "Debug SYMbols." Unix culture tends to whittle down filenames to the absolute minimum. What it contains is just that - the symbol tables that a debugger would need to make ...
Shadur-don't-feed-the-AI's user avatar
9 votes

Install libmysqlclient on CentOs 7

yum whatprovides can find package with specific command or lib, for example: sudo yum whatprovides libmysqlclient* 1:mariadb-libs-5.5.56-2.el7.i686 : The shared libraries required for ...
c ccx's user avatar
  • 109
9 votes

Any work-around to pipe zip files?

If you are open to alternative compression tools, try this almost identical alternative. drt="/var/www/html" mysqldump -u root -p --all-databases | gzip >"$drt/db-$date.gz" If you prefer you can ...
Chris Davies's user avatar
8 votes

How to pass password to mysql command line

As @maxschlepzig said in a comment, Note that there is the MYSQL_PWD environment variable which is read by mysql if you don't specify -p. So in bash: read -s -p "Enter the mysql password for $...
commonpike's user avatar
8 votes

Failed to connect to MySQL: No such file or directory

I believe the issue here is that localhost is not your database host. If that PHP script is running in the "www" docker container, localhost most likely does not have a listening MySQL server. IIRC, ...
GracefulRestart's user avatar
8 votes

How do I capture a MySQL result set in a bash array?

Another way to do it would be to pipe the output of the command to a while loop. Note you want to include the -N or the results include the column name. #!/bin/bash #Script to read output from a ...
Joe M's user avatar
  • 914
8 votes
Accepted

error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

Apparently the program was compiled against a version of MySQL downloaded from www.mysql.com; libmysqlclient.so.20 was not available in Debian. You can download a .deb from https://dev.mysql.com/...
wurtel's user avatar
  • 16.5k
7 votes

After fresh install of mysql-server, can't log in with `mysql root -u`

After my fresh installation of MySQL 8.0.24 on Ubuntu 20.10, I was unable to login with mysql -u root which results in Error 1698 (28000): Access denied for user 'root'@'localhost' However, I was ...
Ng WS's user avatar
  • 71
7 votes
Accepted

Use a password in shell-script

Put something like: [client] user=root password="my-very-secret-password" In a file whose permissions ensure that nobody outside the people who are entitled to read it can read it. And run: #! /bin/...
Stéphane Chazelas's user avatar
7 votes

Preventing any external mysql login tries

Just let mysqld listen on loopback only e.g in /etc/mysql/my.cnf add or change the following configuration bind-address 127.0.0.1 In that way only programs that runs locally can connect to mysql ...
daisy's user avatar
  • 55.9k
7 votes

ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded mysql

I've ran into a similar problem and got it working using this solution. STEP 1: ADD UNIX AUTHENTICATION PLUGIN TO MARIADB CONFIG Change the file /etc/mysql/mariadb.conf.d/50-server.cnf Add the line ...
user10089632's user avatar
7 votes

How can I append comma except lastline?

This is something that's pretty simple to do with awk once you wend your way to the how of it. I use this to "sqlify" any list of items into an SQL-friendly list. You can adapt the BEGIN ...
DopeGhoti's user avatar
  • 79.2k
6 votes
Accepted

Making mysql CLI ask me for a password interactively

Just have the user store the variable beforehand with read: echo "Please enter password for user ${domain}: "; read -s psw mysql -u root -p << MYSQL create user '${domain}'@'localhost' ...
dr_'s user avatar
  • 32.4k
6 votes
Accepted

Variable won't get expanded when INSIDE mysql shell

You can't because the MySQL Shell does not expand environment variables. The Password of user test would be ${sps} literally. But you can let Bash expand the variable and feed the result into MySQL: ...
Frank's user avatar
  • 348
6 votes
Accepted

Any work-around to pipe zip files?

If you really want to use zip, you can use Jeff Schaller’s trick: drt="/var/www/html" mysqldump -u root -p --all-databases | zip "$drt/db-$date.zip" - This will create a ZIP file containing a file ...
Stephen Kitt's user avatar
6 votes
Accepted

Error installing mysql-server on Debian 9 Stretch (dependency problems)

As indicated by your apt policy perl perl-base output, and pointed out by jordanm, your system has the Buster version of Perl, not the Debian 9 version. So your system isn’t really a “fresh install” ...
Stephen Kitt's user avatar
6 votes

How can I install Mysql on Debian 10 (buster)?

Their repository is broken for your request. Compare this file (0k): http://repo.mysql.com/apt/debian/dists/buster/mysql-8.0/binary-i386/Packages to this one (26k) : http://repo.mysql.com/apt/...
Jona's user avatar
  • 147
6 votes

Installing MySQL 5.7 on CentOS 8

As mentioned by Tony above, [the accepted answer], here is a step by step guide for how to install mysql 5.7 on centos 8. Just in case the blog goes down someday, here is the excerpt of all the steps ...
user728650's user avatar
5 votes

Get a progress indicator when importing MySQL databases

sobi3ch's answer is great for most situations, but Pipe Viewer doesn't work well in use cases where a tty isn't available, like when monitoring a mysql docker container's initialization output or when ...
cmorris's user avatar
  • 151

Only top scored, non community-wiki answers of a minimum length are eligible