Error code 1356

When i'll try create some but when i call it appears the error 1356: Creating the View CREATE VIEW monitoring_consult AS ( SELECT m.id, account.valor AS 'phone_number', ...

When i’ll try create some but when i call it appears the error 1356:

Creating the View

CREATE VIEW monitoring_consult AS (
    SELECT 
        m.id,
        account.valor AS 'phone_number',
        IF((c.valor REGEXP '^[0-9]+$' OR c.valor IS NULL) AND cn.short_name IS NOT NULL, cn.short_name, c.valor) AS 'category',
        IF(pn.id IS NOT NULL, pn.id, p.valor) AS 'provider',
        n.valor AS 'nominal',
        m.last_page,
        pn.name AS 'provider_name',
        IF(pay.valor is null, 'Uncompleted', pay.valor) AS 'payment',
        timeEnd,
        DATE_FORMAT(m.timeEnd, '%d/%m/%Y') as 'date'
    FROM
        monitoring AS m
            LEFT JOIN feature   AS account ON m.id = account.id AND account.valor IS NOT NULL AND (account.page = 'PV') AND account.type = 'send'
            LEFT JOIN feature   AS c    ON m.id = c.id_monitoring   AND c.valor IS NOT NULL AND (c.page = 'MA' OR c.page = 'IN') AND c.type = 'select'
            LEFT JOIN feature   AS p    ON m.id = p.id_monitoring   AND p.page = 'PO' AND p.valor IS NOT NULL AND p.type = 'select'
            LEFT JOIN feature   AS n    ON m.id = n.id_monitoring   AND n.valor IS NOT NULL AND n.page = 'OAP' AND n.type = 'select'
            LEFT JOIN feature   AS pay  ON m.id = pay.id_monitoring AND m.last_page = 'OK' AND pay.type = 'userAction'  AND pay.name = 'paymentStatus' AND pay.valor = 'Completed'
            LEFT JOIN terminais AS term ON m.id_terminal = term.id
            LEFT JOIN provider  AS pn   ON (p.valor = pn.id) OR (c.valor REGEXP '^[0-9]+$' AND c.valor = pn.id)
            LEFT JOIN category  AS cn   ON pn.id_category = cn.id
        group by m.id
        having category is not null
)

Calling the view:

select * from monitoring_consult

Return:

Error Code: 1356. View 'qiwi.monitoring_consult' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

Mysql Version — 5.5.32-log

Do someone know why this happened?

Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.

Активные темы Темы без ответов

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

1 2016-06-20 15:33:42

  • mif2001
  • Новичок
  • Неактивен
  • Зарегистрирован: 2016-06-20
  • Сообщений: 1

Тема: Ошибка #1356 Invalid table(s) or column(s) or function(s) or definer

Почтовая программа
Ввод пустой записи и его последующее удаление привело к нарушению связей в Базе данных и таблице, конкретно, «view_users».
Кроме неё есть еще три работающие таблицы.

SQL-запрос: Изменить
SHOW FULL FIELDS FROM  `view_users` ;
Ответ MySQL: Документация
#1356 — View ‘mailserver.view_users’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

Как поступить:
1) Где хранит Oracle базу данных с почтой ?
2) Где хранит виртуальный сервер Базу данных с почтой?
3) Каким способом устранить указанную выше ошибку ?

2 Ответ от Hanut 2016-06-20 15:58:07

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: Ошибка #1356 Invalid table(s) or column(s) or function(s) or definer

1) вероятно где-то в БД mailserver.
2) Там же, где и Oracle.
3) Ошибка говорит о недостатке прав. Проверьте учетную запись которой идет подключение.

Сообщения 2

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

Hello all!
So, I was messing around with a Dev environment to simulate some strategies, doing some tests, and after a mysqldump exporting, dropping, and reimporting my whole database got this error.

If you arrived here from Google, Is this your case?

Well, this happens for a simple reason. The routines are not exported by mysqldump by default. Why? I don’t know either, this is an abomination to me. This would be very cheap to be the default right?

Happens that even for a new database, when importing a dump generated with –all-databases the sys/information_schema routines are deleted by the restore process. Well, at least this is recognized as a Bug (Bug 83259).

I noticed that when trying to query a sys view to get locks info, as per:

root@localhost-(none)-13:46:26>SELECT waiting_trx_id, waiting_pid, waiting_query, blocking_trx_id,
-> blocking_pid, blocking_query FROM sys.innodb_lock_waits;
ERROR 1356 (HY000): View 'sys.innodb_lock_waits' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

Hm.. Weird message, let’s check for information_schema objects:

root@localhost-(none)-13:46:39>select count(*) from information_schema.ROUTINES where ROUTINE_SCHEMA='sys';
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)

Ok, so, if you are already in this mess, how to quick recover?
Well, just run the mysql_upgrade (assuming you are in the top version/repository you have available on server):

root@localhost-(none)-13:47:34>exit
Bye
[root@greporasrv ~]# mysql_upgrade
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log 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
The sys schema is already up to date (version 1.5.1).
Found 0 sys functions, but expected 22. Re-installing the sys schema.
Upgrading the sys schema.
Checking databases.
mysqlslap.t1 OK
[... my other databases...]
sys.sys_config OK
world.city OK
world.country OK
world.countrylanguage OK
Upgrade process completed successfully.
Checking if update is needed.

Fine, lets test it:

[root@greporasrv ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 32
Server version: 5.7.24-log MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

root@localhost-(none)-13:49:44>select count(*) from information_schema.ROUTINES where ROUTINE_SCHEMA='sys';
+----------+
| count(*) |
+----------+
| 48 |
+----------+
1 row in set (0.00 sec)

root@localhost-(none)-13:49:53>

Hope it helps.
Cheers!

Когда я попытаюсь создать некоторые, но когда я позвоню, появится ошибка 1356:

Создание представления

CREATE VIEW monitoring_consult AS (
    SELECT 
        m.id,
        account.valor AS 'phone_number',
        IF((c.valor REGEXP '^[0-9]+$' OR c.valor IS NULL) AND cn.short_name IS NOT NULL, cn.short_name, c.valor) AS 'category',
        IF(pn.id IS NOT NULL, pn.id, p.valor) AS 'provider',
        n.valor AS 'nominal',
        m.last_page,
        pn.name AS 'provider_name',
        IF(pay.valor is null, 'Uncompleted', pay.valor) AS 'payment',
        timeEnd,
        DATE_FORMAT(m.timeEnd, '%d/%m/%Y') as 'date'
    FROM
        monitoring AS m
            LEFT JOIN feature   AS account ON m.id = account.id AND account.valor IS NOT NULL AND (account.page = 'PV') AND account.type = 'send'
            LEFT JOIN feature   AS c    ON m.id = c.id_monitoring   AND c.valor IS NOT NULL AND (c.page = 'MA' OR c.page = 'IN') AND c.type = 'select'
            LEFT JOIN feature   AS p    ON m.id = p.id_monitoring   AND p.page = 'PO' AND p.valor IS NOT NULL AND p.type = 'select'
            LEFT JOIN feature   AS n    ON m.id = n.id_monitoring   AND n.valor IS NOT NULL AND n.page = 'OAP' AND n.type = 'select'
            LEFT JOIN feature   AS pay  ON m.id = pay.id_monitoring AND m.last_page = 'OK' AND pay.type = 'userAction'  AND pay.name = 'paymentStatus' AND pay.valor = 'Completed'
            LEFT JOIN terminais AS term ON m.id_terminal = term.id
            LEFT JOIN provider  AS pn   ON (p.valor = pn.id) OR (c.valor REGEXP '^[0-9]+$' AND c.valor = pn.id)
            LEFT JOIN category  AS cn   ON pn.id_category = cn.id
        group by m.id
        having category is not null
)

Вызов представления:

select * from monitoring_consult

Вернуть:

Error Code: 1356. View 'qiwi.monitoring_consult' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

Версия Mysql — 5.5.32-log

Кто-нибудь знает, почему это произошло?

Создал view
/**
* GeSHi (C) 2004 — 2007 Nigel McNie, 2007 — 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.mysql.geshi_code {font-family:monospace;}
.mysql.geshi_code .imp {font-weight: bold; color: red;}
.mysql.geshi_code .kw1 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw2 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw3 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw4 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw5 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw6 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw7 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw8 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw9 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw10 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw11 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw12 {color: #009900;}
.mysql.geshi_code .kw13 {color: #000099;}
.mysql.geshi_code .kw14 {color: #000099;}
.mysql.geshi_code .kw15 {color: #000099;}
.mysql.geshi_code .kw16 {color: #000099;}
.mysql.geshi_code .kw17 {color: #000099;}
.mysql.geshi_code .kw18 {color: #000099;}
.mysql.geshi_code .kw19 {color: #000099;}
.mysql.geshi_code .kw20 {color: #000099;}
.mysql.geshi_code .kw21 {color: #000099;}
.mysql.geshi_code .kw22 {color: #000099;}
.mysql.geshi_code .kw23 {color: #000099;}
.mysql.geshi_code .kw24 {color: #000099;}
.mysql.geshi_code .kw25 {color: #000099;}
.mysql.geshi_code .kw26 {color: #000099;}
.mysql.geshi_code .kw27 {color: #00CC00;}
.mysql.geshi_code .coMULTI {color: #808000; font-style: italic;}
.mysql.geshi_code .co1 {color: #808080; font-style: italic;}
.mysql.geshi_code .co2 {color: #808080; font-style: italic;}
.mysql.geshi_code .es0 {color: #004000; font-weight: bold;}
.mysql.geshi_code .es1 {color: #008080; font-weight: bold;}
.mysql.geshi_code .br0 {color: #FF00FF;}
.mysql.geshi_code .sy1 {color: #CC0099;}
.mysql.geshi_code .sy2 {color: #000033;}
.mysql.geshi_code .st0 {color: #008000;}
.mysql.geshi_code .nu0 {color: #008080;}
.mysql.geshi_code span.xtra { display:block; }

CREATE OR REPLACE VIEW AuthorizationTrainer AS SELECT Person.id, Person.login as nick, Person.password as pass FROM TABLE2,Person WHERE TABLE2.id_Person = Person.id
 

Задал права:
/**
* GeSHi (C) 2004 — 2007 Nigel McNie, 2007 — 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.mysql.geshi_code {font-family:monospace;}
.mysql.geshi_code .imp {font-weight: bold; color: red;}
.mysql.geshi_code .kw1 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw2 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw3 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw4 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw5 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw6 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw7 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw8 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw9 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw10 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw11 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw12 {color: #009900;}
.mysql.geshi_code .kw13 {color: #000099;}
.mysql.geshi_code .kw14 {color: #000099;}
.mysql.geshi_code .kw15 {color: #000099;}
.mysql.geshi_code .kw16 {color: #000099;}
.mysql.geshi_code .kw17 {color: #000099;}
.mysql.geshi_code .kw18 {color: #000099;}
.mysql.geshi_code .kw19 {color: #000099;}
.mysql.geshi_code .kw20 {color: #000099;}
.mysql.geshi_code .kw21 {color: #000099;}
.mysql.geshi_code .kw22 {color: #000099;}
.mysql.geshi_code .kw23 {color: #000099;}
.mysql.geshi_code .kw24 {color: #000099;}
.mysql.geshi_code .kw25 {color: #000099;}
.mysql.geshi_code .kw26 {color: #000099;}
.mysql.geshi_code .kw27 {color: #00CC00;}
.mysql.geshi_code .coMULTI {color: #808000; font-style: italic;}
.mysql.geshi_code .co1 {color: #808080; font-style: italic;}
.mysql.geshi_code .co2 {color: #808080; font-style: italic;}
.mysql.geshi_code .es0 {color: #004000; font-weight: bold;}
.mysql.geshi_code .es1 {color: #008080; font-weight: bold;}
.mysql.geshi_code .br0 {color: #FF00FF;}
.mysql.geshi_code .sy1 {color: #CC0099;}
.mysql.geshi_code .sy2 {color: #000033;}
.mysql.geshi_code .st0 {color: #008000;}
.mysql.geshi_code .nu0 {color: #008080;}
.mysql.geshi_code span.xtra { display:block; }

GRANT SELECT ON database.AuthorizationTrainer TO ‘Trener’@%
 

/**
* GeSHi (C) 2004 — 2007 Nigel McNie, 2007 — 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.mysql.geshi_code {font-family:monospace;}
.mysql.geshi_code .imp {font-weight: bold; color: red;}
.mysql.geshi_code .kw1 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw2 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw3 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw4 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw5 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw6 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw7 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw8 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw9 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw10 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw11 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw12 {color: #009900;}
.mysql.geshi_code .kw13 {color: #000099;}
.mysql.geshi_code .kw14 {color: #000099;}
.mysql.geshi_code .kw15 {color: #000099;}
.mysql.geshi_code .kw16 {color: #000099;}
.mysql.geshi_code .kw17 {color: #000099;}
.mysql.geshi_code .kw18 {color: #000099;}
.mysql.geshi_code .kw19 {color: #000099;}
.mysql.geshi_code .kw20 {color: #000099;}
.mysql.geshi_code .kw21 {color: #000099;}
.mysql.geshi_code .kw22 {color: #000099;}
.mysql.geshi_code .kw23 {color: #000099;}
.mysql.geshi_code .kw24 {color: #000099;}
.mysql.geshi_code .kw25 {color: #000099;}
.mysql.geshi_code .kw26 {color: #000099;}
.mysql.geshi_code .kw27 {color: #00CC00;}
.mysql.geshi_code .coMULTI {color: #808000; font-style: italic;}
.mysql.geshi_code .co1 {color: #808080; font-style: italic;}
.mysql.geshi_code .co2 {color: #808080; font-style: italic;}
.mysql.geshi_code .es0 {color: #004000; font-weight: bold;}
.mysql.geshi_code .es1 {color: #008080; font-weight: bold;}
.mysql.geshi_code .br0 {color: #FF00FF;}
.mysql.geshi_code .sy1 {color: #CC0099;}
.mysql.geshi_code .sy2 {color: #000033;}
.mysql.geshi_code .st0 {color: #008000;}
.mysql.geshi_code .nu0 {color: #008080;}
.mysql.geshi_code span.xtra { display:block; }

SELECT id,nick FROM AuthorizationTrainer
 

— работает

/**
* GeSHi (C) 2004 — 2007 Nigel McNie, 2007 — 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.mysql.geshi_code {font-family:monospace;}
.mysql.geshi_code .imp {font-weight: bold; color: red;}
.mysql.geshi_code .kw1 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw2 {color: #990099; font-weight: bold;}
.mysql.geshi_code .kw3 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw4 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw5 {color: #999900; font-weight: bold;}
.mysql.geshi_code .kw6 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw7 {color: #FF9900; font-weight: bold;}
.mysql.geshi_code .kw8 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw9 {color: #9900FF; font-weight: bold;}
.mysql.geshi_code .kw10 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw11 {color: #CC0099; font-weight: bold;}
.mysql.geshi_code .kw12 {color: #009900;}
.mysql.geshi_code .kw13 {color: #000099;}
.mysql.geshi_code .kw14 {color: #000099;}
.mysql.geshi_code .kw15 {color: #000099;}
.mysql.geshi_code .kw16 {color: #000099;}
.mysql.geshi_code .kw17 {color: #000099;}
.mysql.geshi_code .kw18 {color: #000099;}
.mysql.geshi_code .kw19 {color: #000099;}
.mysql.geshi_code .kw20 {color: #000099;}
.mysql.geshi_code .kw21 {color: #000099;}
.mysql.geshi_code .kw22 {color: #000099;}
.mysql.geshi_code .kw23 {color: #000099;}
.mysql.geshi_code .kw24 {color: #000099;}
.mysql.geshi_code .kw25 {color: #000099;}
.mysql.geshi_code .kw26 {color: #000099;}
.mysql.geshi_code .kw27 {color: #00CC00;}
.mysql.geshi_code .coMULTI {color: #808000; font-style: italic;}
.mysql.geshi_code .co1 {color: #808080; font-style: italic;}
.mysql.geshi_code .co2 {color: #808080; font-style: italic;}
.mysql.geshi_code .es0 {color: #004000; font-weight: bold;}
.mysql.geshi_code .es1 {color: #008080; font-weight: bold;}
.mysql.geshi_code .br0 {color: #FF00FF;}
.mysql.geshi_code .sy1 {color: #CC0099;}
.mysql.geshi_code .sy2 {color: #000033;}
.mysql.geshi_code .st0 {color: #008000;}
.mysql.geshi_code .nu0 {color: #008080;}
.mysql.geshi_code span.xtra { display:block; }

SELECT id,nick,pass FROM AuthorizationTrainer
 

— не работает
выдает ошибку #1356 — View ‘database.AuthorizationTrainer’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

SHOW GRANTS

GRANT SELECT ON database.`AuthorizationTrainer` TO ‘Trener’@’%’
GRANT SELECT ON database.`Person` TO ‘Trener’@’%’
GRANT SELECT ON database.TABLE2 TO ‘Trener’@’%’

Обычно такая ошибка выдается, если Вы создаете view с SQL SECURITY INVOKER , а пользователь, использующий VIEW, не имеет доступа к каким-то из таблиц/столбцов. Также возможно, что DEFINER у данного VIEW был дефолтный SQL SECURITY DEFINER, а а пользователь, под которым был создан VIEW не имеет больше доступа к одному из полей/таблиц запроса. Подробнее посмотрите здесь

Some versions ago, when you click on a view that have invalid references, you can get the wrong code.
Now, you can not. you got the error and no code is shown. I am using MySQL and MariaDb (several versions)

I liked this feature (I can’t remember when this feature dissapear), and I don’t know if it dissapear and what option Do I have available in order to modify the wrong code and get the right view again.

Steps to reproduce this issue

For reproducing the bug: Let’s create a TABLE and a VIEW
CREATE TABLE foo (
c1 INT NULL,
c2 INT NULL
)
COLLATE=’latin1_swedish_ci’
;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW foo2 AS SELECT *
FROM foo ;

Now, you need to modify the structure of the table, and remove c2 field.

Now, let’s try to read the view. And you got the error!

Expected behavior

In previous versions of HeidiSQL, you still receive the error, BUT you were able to access to the SHOW CREATE VIEW code and modify it. Now, you don’t.

I am trying to find an old HeidiSQL version without this behaviour!

I needed to change the hostname on mysql database logins because the application server name was changed. I ran the following command:

MariaDB [mysql]>  update user set host='app1.example.com' where Host='app2.example.com';
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

Starting with the MariaDB-10.4+ the mysql.user is a view rather than a table.

Always check the official documentation and use SET PASSWORD or ALTER USER to manage user authentication.

If you need to execute massive command rename user, for example because you have change hostname to application server, this script can help you :

An example output :

select user,host from user where host='app1.example.com';
+-----------+-----------------+
| User      | Host            |
+-----------+-----------------+
| USER1     | app1.example.com|
| USER2     | app1.example.com|
| USER3     | app1.example.com|
| USER4     | app1.example.com|
| USER5     | app1.example.com|
+-----------+-----------------+

We need to change Host from app1.example.com to app10.example.com and theoretically you have to run 5 rename user commands, but thanks to this script the command will be generated without writing “by hand”.

SELECT CONCAT('RENAME USER '', user, ''@'',host, '' TO '', user, ''@'app2.example.com';'  ) from mysql.`user` u where host='app1.example.com';
|+-----------+-----------------+-----------------+-----------------+--------------+
|RENAME USER 'USER1'@'app1.example.com' TO 'USER1'@'app2.example.com';            |
|RENAME USER 'USER2'@'app1.example.com' TO 'USER2'@'app2.example.com';            |
|RENAME USER 'USER3'@'app1.example.com' TO 'USER3'@'app2.example.com';            |
|RENAME USER 'USER4'@'app1.example.com' TO 'USER4'@'app2.example.com';            |
|RENAME USER 'USER5'@'app1.example.com' TO 'USER5'@'app2.example.com';            |
+-----------+-----------------+-----------------+-----------------+---------------+

Copy the output and execute.

Enjoy :-).

Понравилась статья? Поделить с друзьями:
  • Error code 1329 no data zero rows fetched selected or processed
  • Error code 11 1312 xerox b210
  • Error code 1327 undeclared variable
  • Error code 11 1312 xerox b205
  • Error code 11 114