ベリーパイインストールmysqlまとめ


文書ディレクトリ
  • ベリーパイインストールmysqlまとめ
  • 1.リモート接続ベリーパイ
  • 2.コマンドラインmysqlデータベース
  • を直接インストール
  • 3.データベースパスワードの変更
  • 4.その他
  • リモートアクセス
  • がオン
    ベリーパイインストールmysqlまとめ
    1.リモート接続ベリーパイ
  • sshを介してリモート・サービス
  • に直接接続する.
    $ ssh [email protected]
    

    2.コマンドライン直接mysqlデータベースをインストールする
  • aptを介してmysqlデータベースを直接インストールします.説明:ベリーパイはmysqlの使用に相当するデータベース(MriaDB)を提供します.具体的なコマンドは以下の
  • です.
    $ sudo apt-get update
    $ sudo apt-get install mariadb-server
    

    3.データベースのパスワードの変更
    $ sudo mysql -u root
    $        
    #       ,    
    
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 13
    Server version: 10.1.37-MariaDB-0+deb9u1 Raspbian 9.0
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> 
    
  • データベースにアクセスして修正する(コードは以下の通り)
  • MariaDB [(none)]> use mysql;
    MariaDB [mysql]> update user set plugin='mysql_native_password' where user='root';
    MariaDB [mysql]> UPDATE user SET password=PASSWORD('root   ') WHERE user='root';
    MariaDB [mysql]> flush privileges;
    MariaDB [mysql]> exit;
    
  • 修正完了後にサービスを再開する
  • $ sudo /etc/init.d/mysql restart
    
  • mysqlのその他の操作status、start、stop、restart
  • 4.その他
    リモート・アクセスの有効化
  • リモートログインを許可
  • $ sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
    #  bind-address     
    #    127.0.0.1        0.0.0.0
    #     
    $ sudo /etc/init.d/mysql restart
    
  • アカウント権
  • を設定
    $ mysql -u root -p
    $     
    MariaDB [(none)]> use mysql;
    MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root   ' WITH GRANT OPTION;
    MariaDB [mysql]> flush privileges;