MySQL

mysqlコマンドがcommand not foundの時

brewで入れたmysqlにPATHが通ってなかった.zshrcに追記 export PATH="/usr/local/opt/mysql@5.6/bin:$PATH"参考weblabo.oscasierra.net

幸せになれるmycli

ずっと補完してほしいと思ってたらこんなステキなのがあるのね‍♀️インストール $ brew install mycliログイン ~ ❯❯❯ mycli -u root -h localhost -D test_table_join mysql 5.6.42 mycli 1.19.0 Chat: https://gitter.im/dbcli/mycli Mail: https://groups.g…

STRICT_TRANS_TABLESに苦しめられた話

カラムのタイプをenumにしたら、データ投入時に怒られるようになってめっちゃ時間取られた件☠️ panic: Got unexpected error: failed to insert into foreign table: models: unable to insert into transactions: Error 1265: Data truncated for column 't…

brewのMySQLを再インストール

プロセスをチェックして切る $ ps -ax | grep mysql $ kill <process_id>brewから削除 バージョン指定してインストールしている場合は、@の後にバージョン追記する $ brew remove mysql@5.6 $ brew cleanup設定ファイル等を消す sudo rm -rf /usr/local/var/mysql ...バ</process_id>…

MySQLユーザーのパスワードを変更

$ mysqladmin --user=root --password=oldpassword password "newpassword"

レコード新規作成時に現在時刻を入れる

> insert into users(created_at, updated_at) values(now(), now() + interval 1 hour);