1. 程式人生 > 資訊 >Facebook 支付 9000 萬美元和解隱私訴訟,需刪除不當收集的資料

Facebook 支付 9000 萬美元和解隱私訴訟,需刪除不當收集的資料

Ubuntu 安裝mysql8

  1. sudo apt-get update #更新源

  2. sudo apt-get install mysql-server #安裝mysql服務

  3. 安裝過程中 繼續執行選 y

  4. sudo mysql_secure_installation #初始化配置

  5. 接下來會逐步選擇設定

    #1
    VALIDATE PASSWORD PLUGIN can be used to test passwords...
    Press y|Y for Yes, any other key for No: N (選擇`N` ,不會進行密碼的強校驗)
    
    #2
    Please set the password for root here...
    New password: (輸入密碼)
    Re-enter new password: (重複輸入)
    
    #3
    By default, a MySQL installation has an anonymous user,
    allowing anyone to log into MySQL without having to have
    a user account created for them...
    Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (選擇`N`,不刪除匿名使用者)
    
    #4
    Normally, root should only be allowed to connect from
    'localhost'. This ensures that someone cannot guess at
    the root password from the network...
    Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N (選擇`N`,允許root遠端連線)
    
    #5
    By default, MySQL comes with a database named 'test' that
    anyone can access...
    Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (選擇`N`,不刪除test資料庫)
    
    #6
    Reloading the privilege tables will ensure that all changes
    made so far will take effect immediately.
    Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (選擇`Y`,修改許可權立即生效)
    
  6. systemctl status mysql.service #檢查mysql服務狀態

  7. 設定遠端訪問

    1. sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf #找到 bind-address 修改值為 0.0.0.0(如果需要遠端訪問)

    2. sudo /etc/init.d/mysql restart #重啟mysql

    3. sudo mysql -uroot -p #輸入密碼進入mysql

    4. mysql>use mysql; #切換資料庫

    5. select host,user,plugin from user; #檢視狀態

    6. 如user為root的host為localhost

      時,則修改為%即可遠端連線,%是允許所有ip訪問

    #設定許可權與密碼
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密碼'; #使用mysql_native_password修改加密規則
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '密碼' PASSWORD EXPIRE NEVER; #更新一下使用者的密碼
    mysql> UPDATE user SET host = '%' WHERE user = 'root'; #允許遠端訪問
    
    #重新整理cache中配置 重新整理許可權
    mysql>flush privileges; 
    mysql>quit;
    
    1. systemctl restart mysql.service #重啟mysql 服務

    2. 此時,即可使用navicat本地連線伺服器中的mysql了