遇到的问题
1、虚拟机ip地址变化,导致连接失败
解决方法: 虚拟机的ip地址总是变,是因为linux默认是自动获取ip,所以在每次我们重启虚拟机的时候IP地址都会换,因此我们将自动获取ip设置为静态获取ip
1、环境搭建:
xshell:连接到远程的Ubuntu
xftp:传输文件
linux开发环境搭建(VMware、Ubuntu安装,xshell安装与配置、VSCode实现远程开发)
vmtool:可以直接拖拽文件传输
2、下载源码
git clone https://github.com/qinguoyi/TinyWebServer.git
(可以用xshell控制远程虚拟机,输入命令下载)
3、 安装配置mysql
3.1安装mysql
sudo apt-get install mysql-server
3.2 进行初始化配置
sudo mysql_secure_installation
#1
VALIDATE PASSWORD PLUGIN can be used to test passwords...
Press y|Y for Yes, any other key for No: N (我的选项)
#2
Please set the password for root here...
New password: (输入密码)
Re-enter new password: (重复输入)
#3
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them...
Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (我的选项)
#4
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 (我的选项)
#5
By default, MySQL comes with a database named 'test' that
anyone can access...
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (我的选项)
#6
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 (我的选项)
3.3检查mysql状态
systemctl status mysql.service
3.4 进入mysql
sudo mysql -uroot -p
3.5 根据readme操作mysql,这里其实就是写sql语句了
分别包括创建数据库 yourdb,use相当于进入这个数据库,创建user表
create database yourdb;
USE yourdb;
CREATE TABLE user(
username char(50) NULL,
passwd char(50) NULL
)ENGINE=InnoDB;
INSERT INTO user(username, passwd) VALUES('name', 'passwd');