Bug #46064 auto-discovery does not discover database
Submitted: 8 Jul 2009 21:49 Modified: 9 Jul 2009 6:48
Reporter: Johan Andersson Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S4 (Feature request)
Version:mysql-5.1-telco-7.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: 7.0.6, auto-discovery, autodiscovery, ndb_restore

[8 Jul 2009 21:49] Johan Andersson
Description:
auto_discovery does not discover mysql databases after ndb_restore

How to repeat:
use test;
create table t1(a integer auto_increment primary key, b char(255))engine=ndb;
insert data into t1
ndb_mgm -e "start backup"

stop the cluster (and mysqlds).
remove the test database from the mysql servers datadir:

rm -rf ${mysql_datadir}/test

start the cluster

restore the backup:
ndb_restore -c "127.0.0.1" -b 1 -n 3 -m .
ndb_restore -c "127.0.0.1" -b 1 -n 3 -r .

start the mysql server.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| mysql              | 
+--------------------+
2 rows in set (0.00 sec)

hmm...

'test' database has not been discovered..
must create manually.
[6 Jun 2012 8:54] Hartmut Holzgraefe
Quick&Dirty shell script solution to create all databases known to cluster:

for db in `ndb_show_tables | grep UserTable | awk '{print $5}' | sort | uniq`
do
  mysql ... -e "CREATE DATABASE IF NOT EXISTS $db;"
done
[12 Dec 2014 11:26] Daniƫl van Eeden
Alternative:
ndb_show_tables --type=2 --parsable | awk '{ print "CREATE SCHEMA IF NOT EXISTS " substr($5,2,length($5)-2) ";"}' | sort -u

This works, but fails to restore the default character set and collation for the schema's.

Bug #55392 is a duplicate of this bug.
[31 Jul 2015 16:14] The Bunker The Bunker
Affects mysql-5.6.25 ndb-7.4.7 also