I see today that
show databases
displays an unknown database:
(msl_ampcs_v4_0_0_2g)> show databases;
+----------------------+
| Database |
+----------------------+
| information_schema |
| #mysql50#.ssh |
| global_lad
Normally when I see something like that it is due to a bad file in /var/lib/mysql:
-rw-r--r-- 1 mysql mysql 1663 Mar 17 2011 /var/lib/mysql/ca-cert.pem
drwx------ 2 mysql mysql 4096 Jun 18 15:00 /var/lib/mysql/global_lad
drwx------ 2 mysql mysql 4096 Jun 18 15:00 /var/lib/mysql/global_lad_unit_test
-rw-rw---- 1 mysql mysql 3231711232 Aug 22 07:20 /var/lib/mysql/ibdata1
-rw-rw---- 1 mysql mysql 5242880 Aug 22 07:20 /var/lib/mysql/ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 Aug 21 16:25 /var/lib/mysql/ib_logfile1
-rw-rw---- 1 mysql mysql 5 Feb 21 2013 /var/lib/mysql/istsdb2.jpl.nasa.gov.pid
-rw-rw---- 1 mysql mysql 4596466 Oct 15 2010 /var/lib/mysql/istsdb2-slow.log
drwx------ 2 mysql mysql 4096 Jul 13 2011 /var/lib/mysql/msl_ampcs_v2_0_0
drwx------ 2 mysql mysql 4096 Jul 21 2012 /var/lib/mysql/msl_ampcs_v3_0_0
drwx------ 2 mysql mysql 4096 Jun 20 02:55 /var/lib/mysql/msl_ampcs_v4_0_0
drwx------ 2 mysql mysql 4096 Sep 5 19:45 /var/lib/mysql/msl_ampcs_v4_0_0_2g
drwx------ 2 mysql mysql 4096 Sep 30 2010 /var/lib/mysql/msl_gdsdb_v5_0
drwx------ 2 mysql mysql 4096 Jan 19 2011 /var/lib/mysql/msl_gdsdb_v5_5
drwx------ 2 mysql mysql 4096 Nov 21 2011 /var/lib/mysql/msl_gdsdb_v5_6
drwx------ 2 mysql root 4096 Mar 23 2010 /var/lib/mysql/mysql
srwxrwxrwx 1 mysql mysql 0 Feb 21 2013 /var/lib/mysql/mysql.sock
-rw------- 1 root root 841 Jun 10 2010 /var/lib/mysql/nohup.out
drwx------ 2 mysql mysql 4096 Feb 5 2013 /var/lib/mysql/pdpp_automation
-rw-r--r-- 1 mysql mysql 1310 Mar 17 2011 /var/lib/mysql/server-cert.pem
-rw-r--r-- 1 mysql mysql 1679 Mar 17 2011 /var/lib/mysql/server-key.pem
But nothing like that is present. The nohup shouldn't be there. But
#mysql50#.ssh
does not appear.
Related
I am using MariaDB with MyRocks engine. After short time, I try to insert bunch of data into some tables (tables could be InnoDB and MyRocks engine), my disk grows very fast. I check MariaDB data directory and I see this:
drwxr-x--x 2 mysql mysql 12K Jun 26 12:07 #rocksdb
drwxr-xr-x 7 mysql mysql 4.0K Jun 26 12:07 .
drwxr-xr-x 6 root root 4.0K Jun 21 10:22 ..
-rw-rw---- 1 mysql mysql 1.1G Jun 25 21:39 1.000001
-rw-rw---- 1 mysql mysql 1.1G Jun 25 21:40 1.000002
-rw-rw---- 1 mysql mysql 1.6G Jun 25 21:44 1.000003
-rw-rw---- 1 mysql mysql 1.1G Jun 25 21:48 1.000004
-rw-rw---- 1 mysql mysql 1.1G Jun 25 21:50 1.000005
-rw-rw---- 1 mysql mysql 218M Jun 26 06:53 1.000006
-rw-rw---- 1 mysql mysql 357 Jun 26 06:56 1.000007
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:06 1.000008
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:09 1.000009
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:17 1.000010
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:19 1.000011
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:22 1.000012
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:24 1.000013
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:27 1.000014
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:29 1.000015
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:32 1.000016
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:34 1.000017
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:37 1.000018
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:40 1.000019
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:42 1.000020
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:45 1.000021
-rw-rw---- 1 mysql mysql 1.1G Jun 26 07:51 1.000022
-rw-rw---- 1 mysql mysql 1.1G Jun 26 08:00 1.000023
-rw-rw---- 1 mysql mysql 1.1G Jun 26 08:07 1.000024
-rw-rw---- 1 mysql mysql 1.1G Jun 26 08:15 1.000025
...
I see many files whose name contains only numbers. I don't know those files were created by MyRocks or MySQL, and can I delete them?
A guess: You configured the following, assuming it turned on binlogging:
log_bin = 1
and those are binlogs starting with the '1'.
A new file every few minutes implies a huge amount of writes (such as the inserts you mention).
If you don't need binlogging and change to this and restart, then the files should stop being created:
log_bin = OFF
The files (1.*) can be removed.
If they don't stop, then my guess is wrong.
If you do need binlogging (for replication and/or point-in-time backups, then we need to investigate the huge rapidity of them.
I'll bet you did a restart about Jun 26 06:53.
Rocksdb is probably not relevant to the question. (But I could be wrong.)
For some reason, I can't start MySql.
$ sudo /etc/init.d/mysql start
[sudo] password for abigail:
Starting MySQL.............................................[FAILED]................................................................................
What caused this?
This is what in my /var/lib/mysql
$ ll -h /var/lib/mysql
total 1005M
-rw-rw----. 1 mysql mysql 16K Mar 28 11:08 aria_log.00000001
-rw-rw----. 1 mysql mysql 52 Mar 28 11:08 aria_log_control
-rw-rw----. 1 mysql mysql 908M Mar 31 20:10 ibdata1
-rw-rw----. 1 mysql mysql 48M Mar 31 20:09 ib_logfile0
-rw-rw----. 1 mysql mysql 48M Mar 31 20:10 ib_logfile1
-rw-rw----. 1 mysql mysql 5 Mar 28 11:09 localhost.pid
-rw-rw----. 1 mysql mysql 0 Oct 29 23:04 multi-master.info
drwx--x--x. 2 mysql mysql 4.0K Oct 29 23:01 mysql
drwx------. 2 mysql mysql 19 Oct 29 23:01 performance_schema
-rw-rw----. 1 mysql mysql 24K Mar 28 11:09 tc.log
drwx------. 2 mysql mysql 4.0K Nov 3 22:10 test
I think I might have to reinstall mysql.
my.cnf is supposed to be in /etc/my.cnf.
Check the start log for the error message, like in /var/log/mysqld.log.
One of our MySQL servers died but somehow we were able to recover all the files from it. This server was a slave at one time however we stopped it being a slave so we could use it for housekeeping tasks and reports, etc.
Can someone tell me how to recover with this?
I now have these files and a backup of my.cnf
ll /root/home/recovered/mysql/
-rw-r----- 1 root root 117 Jun 1 09:30 rabney-relay-bin.000001
-rw-r----- 1 root root 26 Jun 1 09:30 rabney-relay-bin.index
-rw-r----- 1 root root 113055367168 Jun 1 10:42 ibdata1
-rw-r----- 1 root root 1073741824 Jun 1 09:33 ib_logfile0
-rw-r----- 1 root root 1073741824 Jun 1 09:33 ib_logfile1
drwx------ 2 root root 4096 Jun 1 09:30 mysql
drwx------ 2 root root 16384 Jun 1 09:30 production_copy
-rw-r----- 1 root root 3253518648 Jun 1 09:32 slowquery.log
drwx------ 2 root root 4096 Jun 1 09:30 test
I've been reading articles on Google regarding this but not sure how to do it yet.
I don't find the exported file into /tmp folder. Where MYSQL export that file ?
mysql> SELECT oid,t FROM mytable INTO OUTFILE '/tmp/bbb.txt' CHARACTER SET latin1 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n';
ERROR 1086 (HY000): File '/tmp/bbb.txt' already exists
mysql> \q
Bye
usr#locahost:/tmp$ ls -l /tmp
total 210308
-rw------- 1 jetty jetty 0 Feb 27 2014 31020.jsvc_up
-rw------- 1 root root 2210 Dec 13 2013 apticron.hFScRvN3T6
drwxr-xr-x 2 root root 4096 May 25 2014 graphs
srwxr-xr-x 1 root root 0 Aug 6 2014 haproxy.socket
drwx------ 2 jetty jetty 4096 Feb 27 2014 hsperfdata_jetty
drwxr-xr-x 2 root root 4096 Jun 16 04:45 hsperfdata_root
drwx------ 2 usr users 4096 Jul 15 03:36 mc-usr
-rw-r--r-- 1 root root 64 Jul 5 15:18 puppet_failures
-rw-r--r-- 1 usr users 64 Jul 15 03:29 puppet_failures00
usr#locahost:/tmp$
I'm pretty lost right now.
The RAID controller auf my server broke and all attached hard drives were corrupted. Luckily I copied the plain files off the server right before the crash (phew).
I set up the new server with Ubuntu 12.04 and a fresh mysql installation. I copied the backup off a server directly to the new one, without saving them to a windows machine (to prevent privileges errors).
My back up folder looks like this:
drwx------ 15 jensma jensma 4.0K Dec 12 18:09 .
drwxr-xr-x 76 jensma jensma 4.0K Nov 22 12:00 ..
drwx------ 2 mysql mysql 4.0K Nov 21 02:50 gamefilesenter code here
drwx------ 2 mysql mysql 4.0K Aug 5 00:17 circuitboard
-rw-r--r-- 1 mysql mysql 0 Oct 25 07:49 debian-5.5.flag
-rw-rw---- 1 mysql mysql 26M Dec 12 02:22 ibdata1
-rw-rw---- 1 mysql mysql 5.0M Dec 12 18:09 ib_logfile0
-rw-rw---- 1 mysql mysql 5.0M Dec 12 02:22 ib_logfile1
drwx------ 2 mysql mysql 4.0K Oct 25 07:49 mysql
-rw-rw---- 1 mysql mysql 6 Oct 25 07:49 mysql_upgrade_info
drwx------ 2 mysql mysql 4.0K Oct 25 07:49 performance_schema
drwx------ 2 mysql mysql 4.0K May 25 2013 phpmyadmin
drwx------ 2 mysql mysql 4.0K Jul 4 18:29 test
drwx------ 2 mysql mysql 4.0K May 19 2013 usr_web10_5
A folder contains data like this:
drwx------ 2 mysql mysql 4096 Aug 5 00:17 .
drwx------ 15 jensma jensma 4096 Dec 12 18:09 ..
-rw-rw---- 1 mysql mysql 65 Jul 10 15:04 db.opt
-rw-rw---- 1 mysql mysql 8620 Aug 1 23:38 stat.frm
-rw-rw---- 1 mysql mysql 8700 Aug 5 00:17 user.frm
I just copied the whole content to /var/lib/mysql and ran
sudo /usr/sbin/mysqld –innodb_log_file_size=5242880 –innodb_force_recovery=6
Well, the command kinda works - the shell shows up after half a minute. But the database is still empty :/
I'm pretty now to this. I do have full admin access to the server.
Any help is appreciated, thanks!