| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
1,522 バイト追加 、 2023年11月13日 (月) 10:57
# [[chkconfig]] | grep "mysql"
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
===[[Mac]](brewからクライアントのみインストール)===
<pre>
$ brew install mysql-client
</pre>
*インストールログの末尾を参照してPATHを通す
 
===権限の初期設定===
*http://dev.mysql.com/doc/refman/5.1-olh/ja/unix-post-installation.html
=====Failed! Error: SET PASSWORD has no significance for user... エラー=====
----
*https://level69.net/archives/30666上記「Ubuntu 初期パスワードの場所」のユーザーでログイン
<pre>
Estimated strength of the password: 100
*https://dev.mysql.com/doc/refman/8.0/ja/resetting-permissions.html
<pre>
ubuntu@ip-172-26-11-57:~$ sudo systemctl stop mysql-u debian-sys-maint -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 9Server version: 8.0.30-0ubuntu0.20.04.2 (Ubuntu) Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> set password for 'root'@'localhost' = 'NewPassword';ERROR 4102 (HY000): SET PASSWORD has no significance for user 'root'@'localhost' as the authentication method used doesn't store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.
</pre>
*mysql.initファイルに記入以下で成功!
<pre>
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY WITH mysql_native_password by 'MyNewPassNewPassword';Query OK, 0 rows affected (0.01 sec)
</pre>
*ファイルを引数に起動
<pre>
$ mysqld mysql> select version();+--------------init-file=/home/ubuntu/mysql.init &----------+| version() |</pre>+-------------------------+*サーバーは、起動時に mysql| 8.0.30-0ubuntu0.20.04.initシステム変数で指定されたファイルの内容を実行し、'root'@'localhost'アカウントのパスワードを変更します。2 |*サーバーの通常の起動方法によっては、その他のオプションも必要になる場合があります。 たとえば、init_file 引数の前に +--defaults-file が必要な場合があります。----------------------+*サーバーが正常に起動されたら mysql1 row in set (0.initを削除します。<pre>00 sec)
</pre>
===[[phpMyAdmin]]===
*[[phpMyAdmin]]
 
===ポートフォワーディング===
*ssh -i 踏み台サーバー鍵ファイル -L ローカルポート:本当に接続したいサーバー:本当に接続したいサーバーのポート 踏み台サーバーユーザー@踏み台サーバー
<pre>
$ ssh -i ~/.ssh/typea-dev-key.pem -L 13308:typea-dev-mysql-multiaz.c5ihdpszudfw.us-east-1.rds.amazonaws.com:3306 ec2-user@34.226.213.144
</pre>
RDSにEC2を踏み台にして、SQLWorkbentchから接続
 
[[File:port_forwarding.png|600px]]
==管理==
kill [Id]
==[[SQL]]==
===カンマ区切り文字列をSplitする===
SUBSTRING_INDEX(comma_string,',',1),
SUBSTRING_INDEX(SUBSTRING_INDEX(comma_string,',',1),',',1),
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(comma_string,',',1),',',1),',',1),
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(comma_string,',',1),',',1),',',1),',',1)
 
 
===制約を無視してテーブルをtruncateする===
----
mysql&gt; truncate table hoge;
mysql&gt; SET FO[[R]]EIGN_KEY_CHECKS=1;
 
===パーティショニング===
----

案内メニュー