LoginSignup
0
0

More than 5 years have passed since last update.

mysqlからviewのdefiner一覧を取得するワンライナー

Posted at
$ DB='<database_name>'; sudo mysql -NBe "select concat('show create view ',TABLE_NAME, ';') from information_schema.tables where TABLE_TYPE = 'VIEW' and  TABLE_SCHEMA = '$DB';" | sudo mysql $DB | awk '{print $1,$4}' | grep DEFINER

sample_view1 DEFINER=`user`@`host`
sample_view1 DEFINER=`user`@`%`
sample_view1 DEFINER=`user`@`localhost`
  • <database_name> に対象のDB名を
  • mysqlのユーザー・パスワード指定は適当に
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0