1.インストール
$ sudo apt update
$ sudo apt install mysql-server
2. [設定のmysql
$ sudo mysql_secure_installation
1つ目は、rootユーザーのパスワードを設定することです。
ルートパスワードを正常に設定すると、一連のセキュリティ設定が行われます。
Remove anonymous users? (Press y|Y for Yes, any other key for No) : n
... skipping.
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) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
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
Success.
All done!
3.確認してくださいのインストールMySQLを:
$ systemctl status mysql.service
4、使用してルートだけセットにログインするためのコマンドとパスワードをMySQLの行きます
1,登进MySQL之后,
$ sudo mysql -uroot –p
2,输入以下语句,进入mysql库:
use mysql
3,更新域属性,'%'表示允许外部访问:
update user set host='%' where user ='root';
4,执行以上语句之后再执行:
FLUSH PRIVILEGES;
5,再执行授权语句:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
エラー:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql_secure_installation
update user set host='localhost' where user ='root'' at line 1
SQLを実行します。
mysql.userからuser、host、passwordを選択します。
SQLを実行します。
ALTER USER 'ルート' @ 'localhostの' IDENTIFIED BY '_huitao' ;
更新
フラッシュ特権;
パラメータの変更:
注意8.0が持っているより多くの変数を持つ「」よりも5.7を、のでそれの半分を設定することは十分ではありません
グローバルvalidate_password.policy = 0を設定します。
グローバルvalidate_password.length = 4を設定します。
次に終了して実行します
mysql_secure_installation
ユーザーセットの更新plugin = "mysql_native_password"、authentication_string = password( '設定的密码')where user = "root";
権限の更新
FLUSHPRIVILEGES;
Navicaはデータベースソリューションに接続できません:
1.次のステートメントを使用して、MySQLの現在の暗号化モードを表示します
ユーザーからホスト、ユーザー、プラグインを選択します。
最初の行を見てください。ルート暗号化方式はcaching_sha2_passwordです。
2.コマンドを使用して、彼をmysql_native_password暗号化モードに変更します。
ユーザーセットplugin = 'mysql_native_password'を更新します。ここでuser = 'root';
Navicaはデータベースに接続します。