This is a very common error which can have multiple causes.
_
are allowed in user names'bob'@'%'
will match any host, except localhost, depending on your situation, you may need distinct entries :
'bob'@'%'
'bob'@'localhost'
https://dba.stackexchange.com/questions/10852/mysql-error-access-denied-for-user-alocalhost-using-password-yes/10897#answer-10897 When the Host and the User values in more than one user table record match a client, the server must decide which one to use. It does this by sorting records with the most specific Host and User column values first, and choosing the matching record that occurs first in the sorted list, Sorting take place as follows: In the Host Column, literal values such as localhost, 127.0.0.1, and myhost.example.com sort ahead of values such as %.example.com that have pattern characters in them. Pattern values are sorted according to how specific they are. For example, %.example.com is more specific than %.com, which is more specific than %. Make sure that * every user has a password. * there are no anonymous users (when user is blank)
https://dba.stackexchange.com/questions/10852/mysql-error-access-denied-for-user-alocalhost-using-password-yes/10897#answer-10890 The '%' host wildcard doesn't match 'localhost'. By default the mysql client will try to connect via a socket rather than tcp (usually some place like /var/lib/mysql/mysql.sock). If you don't specify a -h hostname it assumes "localhost" meaning it's looking for a socket, not a TCP port w/o the protocol flag.
^ *(([0-9]+\.){3}[0-9]+).*$
/\1
/p'"; done; host $hostnameBase-$environment.ope.$domain | awk '{print $NF}'10.203.15.8
10.203.15.8
10.203.15.8 match !
10.203.10.11
10.203.10.11
10.203.10.6 Houston, we have a problem !
Distributor ID: Debian Description: Debian GNU/Linux 8.10 (jessie) Release: 8.10 Codename: jessie
show slave status\G
' | grep 'Last_Err'Last_Errno: 1932 Last_Error: Unable to load replication GTID slave state from mysql.gtid_slave_pos: Table 'mysql.gtid_slave_pos' doesn't exist in engine
select count(1) from mysql.gtid_slave_pos;
'ERROR 1932 (42S02) at line 1: Table 'mysql.gtid_slave_pos' doesn't exist in engine
This installation of MySQL is already upgraded to 10.0.32-MariaDB, use --force if you still need to run mysql_upgrade
Phase 1/6: Checking and upgrading mysql database Processing databases mysql mysql.column_stats OK mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK mysql.gtid_slave_pos Error : Table 'mysql.gtid_slave_pos' doesn't exist in engine status : Operation failed mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK mysql.help_topic OK mysql.host OK mysql.index_stats OK mysql.innodb_index_stats Error : Table 'mysql.innodb_index_stats' doesn't exist in engine status : Operation failed mysql.innodb_table_stats Error : Table 'mysql.innodb_table_stats' doesn't exist in engine status : Operation failed mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK Repairing tables mysql.gtid_slave_pos Error : Table 'mysql.gtid_slave_pos' doesn't exist in engine status : Operation failed mysql.innodb_index_stats Error : Table 'mysql.innodb_index_stats' doesn't exist in engine status : Operation failed
use mysql; -- -- Table structure for table `gtid_slave_pos` -- DROP TABLE IF EXISTS `gtid_slave_pos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `gtid_slave_pos` ( `domain_id` int(10) unsigned NOT NULL, `sub_id` bigint(20) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, `seq_no` bigint(20) unsigned NOT NULL, PRIMARY KEY (`domain_id`,`sub_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Replication slave GTID position'; /*!40101 SET character_set_client = @saved_cs_client */;
ERROR 1813 (HY000): Tablespace for table '`mysql`.`gtid_slave_pos`' exists. Please DISCARD the tablespace before IMPORT.
ALTER TABLE `mysql`.`gtid_slave_pos` DISCARD TABLESPACE;
ERROR 1146 (42S02): Table 'mysql.gtid_slave_pos' doesn't exist
/var/lib/mysql/data/mysql/gtid_slave_pos.frm
/var/lib/mysql/data/mysql/innodb_index_stats.frm
/var/lib/mysql/data/mysql/innodb_table_stats.frm
Now let's clean up (simulating file deletion) :
-- -- Dumping data for table `gtid_slave_pos` -- LOCK TABLES `gtid_slave_pos` WRITE; /*!40000 ALTER TABLE `gtid_slave_pos` DISABLE KEYS */; /*!40000 ALTER TABLE `gtid_slave_pos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `innodb_index_stats` -- DROP TABLE IF EXISTS `innodb_index_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `innodb_index_stats` ( `database_name` varchar(64) COLLATE utf8_bin NOT NULL, `table_name` varchar(64) COLLATE utf8_bin NOT NULL, `index_name` varchar(64) COLLATE utf8_bin NOT NULL, `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `stat_name` varchar(64) COLLATE utf8_bin NOT NULL, `stat_value` bigint(20) unsigned NOT NULL, `sample_size` bigint(20) unsigned DEFAULT NULL, `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `innodb_index_stats` -- LOCK TABLES `innodb_index_stats` WRITE; /*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; /*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `innodb_table_stats` -- DROP TABLE IF EXISTS `innodb_table_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `innodb_table_stats` ( `database_name` varchar(64) COLLATE utf8_bin NOT NULL, `table_name` varchar(64) COLLATE utf8_bin NOT NULL, `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `n_rows` bigint(20) unsigned NOT NULL, `clustered_index_size` bigint(20) unsigned NOT NULL, `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL, PRIMARY KEY (`database_name`,`table_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `innodb_table_stats` -- LOCK TABLES `innodb_table_stats` WRITE; /*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; /*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `slave_master_info` -- DROP TABLE IF EXISTS `slave_master_info`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `slave_master_info` ( `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.', `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.', `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.', `Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.', `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.', `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.', `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.', `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.', `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.', `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.', `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.', `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.', `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.', `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.', `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.', `Heartbeat` float NOT NULL, `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server', `Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs', `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.', `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.', `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)', `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files', `Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.', PRIMARY KEY (`Host`,`Port`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `slave_master_info` -- LOCK TABLES `slave_master_info` WRITE; /*!40000 ALTER TABLE `slave_master_info` DISABLE KEYS */; /*!40000 ALTER TABLE `slave_master_info` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `slave_relay_log_info` -- DROP TABLE IF EXISTS `slave_relay_log_info`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `slave_relay_log_info` ( `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.', `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.', `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.', `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.', `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.', `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.', `Number_of_workers` int(10) unsigned NOT NULL, `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.', PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `slave_relay_log_info` -- LOCK TABLES `slave_relay_log_info` WRITE; /*!40000 ALTER TABLE `slave_relay_log_info` DISABLE KEYS */; /*!40000 ALTER TABLE `slave_relay_log_info` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `slave_worker_info` -- DROP TABLE IF EXISTS `slave_worker_info`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `slave_worker_info` ( `Id` int(10) unsigned NOT NULL, `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `Relay_log_pos` bigint(20) unsigned NOT NULL, `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `Master_log_pos` bigint(20) unsigned NOT NULL, `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL, `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL, `Checkpoint_seqno` int(10) unsigned NOT NULL, `Checkpoint_group_size` int(10) unsigned NOT NULL, `Checkpoint_group_bitmap` blob NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `slave_worker_info` -- LOCK TABLES `slave_worker_info` WRITE; /*!40000 ALTER TABLE `slave_worker_info` DISABLE KEYS */; /*!40000 ALTER TABLE `slave_worker_info` ENABLE KEYS */; UNLOCK TABLES;This worked fine
select count(1) from mysql.gtid_slave_pos;
'+----------+ | count(1) | +----------+ | 2 | +----------+
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 104 "Connection reset by peer"
Message: Lost connection to MySQL server during query
mysqld: 131125 9:38:01 InnoDB: The InnoDB memory heap is disabled mysqld: 131125 9:38:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins mysqld: 131125 9:38:01 InnoDB: Compressed tables use zlib 1.2.3.4 mysqld: 131125 9:38:01 InnoDB: Using Linux native AIO mysqld: 131125 9:38:01 InnoDB: Initializing buffer pool, size = 11.0G mysqld: InnoDB: mmap(12087984128 bytes) failed; errno 12 mysqld: 131125 9:38:01 InnoDB: Completed initialization of buffer pool mysqld: 131125 9:38:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool mysqld: 131125 9:38:01 [ERROR] Plugin 'InnoDB' init function returned error. mysqld: 131125 9:38:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. mysqld: 131125 9:38:01 [ERROR] Unknown/unsupported storage engine: InnoDB mysqld: 131125 9:38:01 [ERROR] Aborting mysqld: 131125 9:38:01 [Note] /usr/sbin/mysqld: Shutdown complete mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended
Run the big query : mysql -u root -p****** < tmp.sql > alterView.sql For some unknown reason, the "big query" resulted in a : CONCAT("ALTER DEFINER='.....(unterminated WTF-query) And 5 legal "ALTER DEFINER=..." queries. edit alterView.sql to remove the WTF-query mysql -u root -p****** dbName < alterView.sql If it complains : The user specified as a definer ('root'@'10.0.16.0/255.255.255.0') does not exist INSERT INTO mysql.user (User, Host) VALUES ('root', '10.0.16.0/255.255.255.0'); ==> YOU'RE F***ED ! Re-import the views (see details)
skip-networking bind-address = 127.0.0.1from /etc/mysql/my.cnf, and restart MySQL : /etc/init.d/mysql restart