MySQL 外部から接続できるユーザーを追加する

開発環境のDBで外部から全許可したい要望があったので、全許可できるユーザーを追加してそのユーザーは外部接続できるようにします。
まずは、現状で接続できるユーザー等を確認します
mysql> select use ...Apache再起動でエラー「Address already in use: make_sock: could not bind to address 」

少し古めのサーバーで、Apacheを再起動したら下記のように「Address already in use: make_sock: could not bind to address …」とエラーになりました
$ s ...シェルスクリプトでインクリメント(i++)処理をする

シェルスクリプトで、for文やwhile文でよく使う「i++」のインクルメント処理があります。
インクルメント処理は、変数に「1」を加算する処理です。
また、このインク ...
/var/log/wtmp の内容を確認する

ログインに成功したユーザーのIPアドレスの履歴を調べたくて、履歴が記載されているファイルの「/var/log/wtmp」を確認しようと思いましが、このファイルはバイナリファイルで「cat」,「vi」等のコマンドでは内容を確認できません ...
csvファイルをsortコマンドで並び替えする

sortコマンドを利用して、CSVファイルなどの ○列目 の数字をキーにして並び替えしたい場合があります。
昇順に並び替えする場合は、下記のようにします。
書式:s ...
ファイルの文字コードを変換する【iconv】

Linuxでファイルの文字コードを変換するには「iconv」,「nkf」コマンドを利用すればできますが、この記事では「iconv」コマンドでファイルの文字コードを変換する方法を紹介します。
「iconv」はオプション等は「 ...
wcコマンドでファイルの行数を取得する

Linuxでファイルの行数を取得したい場合は、「wc -l ファイル名」のコマンドで取得できます。「-l, –lines」のオプションは、ファイルの改行数を出力します
$ cat aaa.txt 12345$ wc ...Linuxでファイルの文字コード・改行コードを確認する

「nkf」コマンドを利用してファイルの文字コード・改行コードを確認する方法を説明します。
「nkf」がインストールされていない場合は、yumコマンドでインストールして下さい。 ...
WordPress ヘルスチェックエラー対応 (imagickがインストールされていないか無効化)

久しぶりにWordpressでヘルスチェックをおこなうと下記のようjに、「オプションのモジュール imagickがインストールされていないか、無効化されています。」と表示されています。
imagick は以前の記事「Wor ...
シェルスクリプトで件名に空白が含まれる場合、メールする宛先がおかしくなる

シェルスクリプトでメールを送信する際に件名に空白が含まれる場合、送付する宛先がおかしくなるケースがありました
#!/bin/bashSUBJECT="test1 test2 test3"echo "test mail" | ma ...LinuxからGmailにメールを送るとnonameという添付される

Linuxのサーバーから下記のようなシェルスクリプトでechoコマンドで内容をメール本文に出力して、Gmailにメールすると出力した内容の「noname」というファイルが添付されメールされるケースがありました
#!/bin/ba ...mailx コマンドで添付ファイルをつけてメールを送る

mailxコマンドで添付ファイルを送る場合ですが「-a <添付ファイル>」とすれば添付ファイルをつけてメールを送信することができます
「mailx」コマンドがインストールされていない場合は、yum, dnfコマ ...
diff で改行・空白を無視して比較する

diffコマンドは、ファイルを比較する時によく使うコマンドですが、空白や改行も比較対象として比較されます。
その場合は、「-w」、「-B」のオプションを利用すると、空白を無視したり、空行の ...
tinydnsで逆引きレコードを設定する

使用していたドメインが解約になり、それに紐づいていたIPアドレスを違うドメインに設定したのですが、逆引きが設定がうまくいかず苦労していました。
DNSは、tinydnsを使用している環境で、tinydnsに逆引きレコードを ...
Let’s Encrypt証明書発行を「acme.sh」で発行する (マルチドメイン)

「www.example.com」, 「example.com」 等のサブドメインの異なるドメインを1枚の証明書で発行できるマルチドメイン証明書を、無償の証明書のLet’s Enc ...