MySQL Server セットアップ

8.0


sudo apt update

pip install mysql-connector-python

sudo apt install mysql-server

sudo systemctl status mysql

sudo mysql_secure_installation

ノンパスでログイン
sudo mysql -u root

rootパスワード設定
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新しいパスワード';

権限適応
FLUSH PRIVILEGES;

mysql -u root -p

データベース作成
CREATE DATABASE mydatabase;

データベース用のユーザー追加
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

閲覧は特定データベースのみ
GRANT ALL PRIVILEGES ON mydatabase.* TO 'newuser'@'localhost';

権限適応
FLUSH PRIVILEGES;

パスワードハッシュ対応のためインストールしておく
pip install cryptography

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny

タイトルとURLをコピーしました