Mysql数据库自建,使用,问题排查最佳实践 配置远程登录 plaintext [root@localhost install] ln sf /mysql/install/mysql.sock /tmp/mysql.sock [root@localhost install] mysql uroot predhat mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 10 Server version: 8.4.0 MySQL Community Server GPL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> show databases; + Database + informationschema mysql performanceschema sys + 4 rows in set (0.02 sec) mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with A Database changed mysql> select Host,User from user; ++ Host User ++ localhost mysql.infoschema localhost mysql.session localhost mysql.sys localhost root ++ 4 rows in set (0.00 sec) mysql> create user 'root'@'%' identified by 'redhat'; 创建root用户并设置密码为redhat Query OK, 0 rows affected (0.09 sec) mysql> grant all privileges on . to 'root'@'%' with grant option; 赋予root用户所有权限 Query OK, 0 rows affected (0.03 sec) mysql> flush privileges; 刷新权限使之生效 Query OK, 0 rows affected (0.01 sec) mysql> select Host,User from user; ++ Host User ++ % root localhost mysql.infoschema localhost mysql.session localhost mysql.sys localhost root ++ 5 rows in set (0.00 sec) mysql> exit Bye