SSH into Xserver (shared hosting) MySQL and output Select results. We’ll try accessing the WordPress database, executing a select statement, and retrieving a list of IDs of published posts. This is like a memo.
I heard that if you create an ssh tunnel in the background, you can easily ssh from the local console with the -P specification, but for some reason I couldn’t do it, so I forced it.
ssh -p 10022 -i ~/.ssh/yuis.key [email protected] <<'EOT'
env -i bash --norc --noprofile <<'EOF'
mysql -h "mysql2007.xserver.jp" -u yourdatabaseusrename -p"yourpassword" -P 3306
USE yuis_programming2 ;
select ID,guid from wp_posts where post_type='post' AND post_status='publish';
EOF
EOT
e.g.
ssh -p 10022 -i ~/.ssh/yuis.key [email protected] <<'EOT' | wc
env -i bash --norc --noprofile <<'EOF'
mysql -h "mysql2007.xserver.jp" -u user_1234 -p"1234" -P 3306
USE yuis_programming2 ;
select ID,guid from wp_posts where post_type='post' AND post_status='publish';
EOF
EOT