ユーザ用ツール

サイト用ツール


mysql

ubuntuにinstall

apt-get install mysql-server mysql-client

ちなみにuninstall

apt-get purge mysql-server mysql-common

設定

セキュリティ設定ツール(rootパスワード等)

sudo mysql_secure_installation
sudo mysql -u root

設定ファイル(/etc/mysql/mysql.conf.d/mysqld.conf)

character-set-  = utf8

bind-address = 

backup

$ mysqldump -u root データベース名 > dump.sql

オプション

  • –add-drop-table
  • –no-create-info (-t)
  • –no-data (-d)

restore

$ mysql -u root データベース名 < dump.sql 

create database

db作成

create database xxxxdb;

ユーザ作成

create user 'xxxxid'@'localhost' identified by 'xxxxpass';

ユーザにDB権限追加

GRANT ALL on xxxxdb.* to 'xxxxid'@'localhost' identified by 'xxxxpass';

sshで接続

#!/bin/bash
ssh -f -N -L 3307:localhost:3306 -i .ssh/rsa.pem user@host
sleep 3
mysql --user=uid --password=pwd --host=127.0.0.1 --port=3307
mysql.txt · 最終更新: 2021/06/06 22:37 by nabezo