阿里云服务器中数据库的连接

时间:2022-01-26 11:07:59
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/home# cd /etc
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc# cd mysql
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc/mysql# ls
conf.d  debian.cnf  debian-start  my.cnf  my.cnf.fallback  mysql.cnf  mysql.conf.d
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc/mysql# cd mysql.conf.d
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc/mysql/mysql.conf.d# ls
mysqld.cnf  mysqld_safe_syslog.cnf
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc/mysql/mysql.conf.d# vim mysqld.cnf
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc/mysql/mysql.conf.d# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.22-0ubuntu0.16.04.1 (Ubuntu)


Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.


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> 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
    -> ;
+-----------+
| User      |
+-----------+
| localhost |
| localhost |
| localhost |
| localhost |
+-----------+
4 rows in set (0.00 sec)


mysql> select Host,User from user
    -> ;
+-----------+------------------+
| Host      | User             |
+-----------+------------------+
| localhost | debian-sys-maint |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
4 rows in set (0.00 sec)


mysql> update user set Host='%' where User='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0


mysql> select Host,User from user;
+-----------+------------------+
| Host      | User             |
+-----------+------------------+
| %         | root             |
| localhost | debian-sys-maint |
| localhost | mysql.session    |
| localhost | mysql.sys        |
+-----------+------------------+
4 rows in set (0.00 sec)


mysql> flush pricileges;
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 'pricileges' at line 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


mysql> exit()
    -> ;
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 'exit()' at line 1
mysql> exit;
Bye
(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc/mysql/mysql.conf.d# service mysql restart

(firstvirtualenv) root@iZwz980ructn8c30g25slxZ:/etc/mysql/mysql.conf.d# 


========================(二)==========================

https://blog.csdn.net/baidu_31950961/article/details/73251973