本文章介绍从部署项目与导入数据库方面,去简化测试人员的工作。
前提: ping命令判断是否处于同一网段
本机ip查看方法
windows下通过ipconfig查询本机ip
mac下通过“系统偏好设置->网络”查看本机ip
两台电脑互相ping对象电脑的IP
tips:如果出现ping不通的现象,windows系统请关闭电脑的防火墙。
项目访问
通过查看部署主机Ip,然后通过Ip+端口+项目路径进行项目访问
如下,通过部署主机IP(172.22.129.74),项目端口(8080)进行项目访问。
http://172.22.129.74:8080/login
数据库访
首先进入mysql命令行,下图为mac系统:
[r@R ~]$/usr/local/MySQL/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 5.7.21 MySQL Community Server (GPL)
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数据库
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
查询user表数据
mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
| localhost | test |
+-----------+---------------+
4 rows in set (0.00 sec)
tips:test用户是为测试人员提供的测试用户。可以使用insert语句进行添加。
使用update语句更改test用户的host
mysql> update user set host='%' where host= 'test';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
tips:%表示匹配所有ip,也可以将host更改为指定ip。
另外查询一下user表数据,确认更改成功。
mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
| localhost | test |
+-----------+---------------+
4 rows in set (0.00 sec)
执行flush privileges,使更改生效
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
至此,测试人员即可使用部署主机ip,test用户与密码连接mysql数据库。
对mysql用户配置权限
注:以下配置权限使用navicat数据可视化工具进行实现,也可以选择其他方式进行实现。
通过以上操作可以针对具体用户配置mysql权限,以及具体的数据库权限。