当前位置: 首页 > 工具软件 > Fedora Func > 使用案例 >

fedora 20 安装mysql_Fedora 安装mysql

景靖琪
2023-12-01

[root@localhost ~]#mysql -uroot -p -hlocalhost

OK,登陆成功

修改root登陆密码方法如下:

3、在环境A上登陆环境B上的mysql数据库

------------------------------------------------------------------------------------

[root@localhost ~]# mysql -uroot -p -h192.168.62.129

Enter password:

ERROR 1130 (00000): Host '192.168.62.128' is not allowed to connect to this MySQL server

[root@localhost ~]#

------------------------------------------------------------------------------------

这是因为mysql指定了某个账户只能由某个服务器登陆,可以通过在环境B上进行下面非配置解决:

3.1、修改root账户,只有192.168.62.128登陆root,则在环境B登陆mysql,进行如下配置:

------------------------------------------------------------------------------------

[root@localhost ~]# mysql -uroot -p -hlocalhost

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

+--------------------+

3 rows in set (0.00 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> show tables;

+---------------------------+

| Tables_in_mysql           |

+---------------------------+

| columns_priv              |

| db                        |

| func                      |

| help_category             |

| help_keyword              |

| help_relation             |

| help_topic                |

| host                      |

| proc                      |

| procs_priv                |

| tables_priv               |

| time_zone                 |

| time_zone_leap_second     |

| time_zone_name            |

| time_zone_transition      |

| time_zone_transition_type |

| user                      |

+---------------------------+

17 rows in set (0.00 sec)

mysql> update user set host='%' where user='root';

ERROR 1062 (23000): Duplicate entry '%-root' for key 1

mysql> describe user;

+-----------------------+-----------------------------------+------+-----+---------+-------+

| Field                 | Type                              | Null | Key | Default | Extra |

+-----------------------+-----------------------------------+------+-----+---------+-------+

| Host                  | char(60)                          | NO   | PRI |         |       |

| User                  | char(16)                          | NO   | PRI |         |       |

| Password              | char(41)                          | NO   |     |         |       |

| Select_priv           | enum('N','Y')                     | NO   |     | N       |       |

| Insert_priv           | enum('N','Y')                     | NO   |     | N       |       |

| Update_priv           | enum('N','Y')                     | NO   |     | N       |       |

| Delete_priv           | enum('N','Y')                     | NO   |     | N       |       |

| Create_priv           | enum('N','Y')                     | NO   |     | N       |       |

| Drop_priv             | enum('N','Y')                     | NO   |     | N       |       |

| Reload_priv           | enum('N','Y')                     | NO   |     | N       |       |

| Shutdown_priv         | enum('N','Y')                     | NO   |     | N       |       |

| Process_priv          | enum('N','Y')                     | NO   |     | N       |       |

| File_priv             | enum('N','Y')                     | NO   |     | N       |       |

| Grant_priv            | enum('N','Y')                     | NO   |     | N       |       |

| References_priv       | enum('N','Y')                     | NO   |     | N       |       |

| Index_priv            | enum('N','Y')                     | NO   |     | N       |       |

| Alter_priv            | enum('N','Y')                     | NO   |     | N       |       |

| Show_db_priv          | enum('N','Y')                     | NO   |     | N       |       |

| Super_priv            | enum('N','Y')                     | NO   |     | N       |       |

| Create_tmp_table_priv | enum('N','Y')                     | NO   |     | N       |       |

| Lock_tables_priv      | enum('N','Y')                     | NO   |     | N       |       |

| Execute_priv          | enum('N','Y')                     | NO   |     | N       |       |

| Repl_slave_priv       | enum('N','Y')                     | NO   |     | N       |       |

| Repl_client_priv      | enum('N','Y')                     | NO   |     | N       |       |

| Create_view_priv      | enum('N','Y')                     | NO   |     | N       |       |

| Show_view_priv        | enum('N','Y')                     | NO   |     | N       |       |

| Create_routine_priv   | enum('N','Y')                     | NO   |     | N       |       |

| Alter_routine_priv    | enum('N','Y')                     | NO   |     | N       |       |

| Create_user_priv      | enum('N','Y')                     | NO   |     | N       |       |

| ssl_type              | enum('','ANY','X509','SPECIFIED') | NO   |     |         |       |

| ssl_cipher            | blob                              | NO   |     |         |       |

| x509_issuer           | blob                              | NO   |     |         |       |

| x509_subject          | blob                              | NO   |     |         |       |

| max_questions         | int(11) unsigned                  | NO   |     | 0       |       |

| max_updates           | int(11) unsigned                  | NO   |     | 0       |       |

| max_connections       | int(11) unsigned                  | NO   |     | 0       |       |

| max_user_connections  | int(11) unsigned                  | NO   |     | 0       |       |

+-----------------------+-----------------------------------+------+-----+---------+-------+

37 rows in set (0.12 sec)

------------------------------------------------------------------------------------

mysql>use mysql;

mysql>update user set host='192.168.62.128' where user='root';

mysql>flush privileges;

------------------------------------------------------------------------------------

3.2、修改root账户,任意用户登陆root,则在环境B登陆mysql,进行如下配置:

------------------------------------------------------------------------------------

 类似资料: