目录
mysql命令
语法
选项
参数
实例
安装php
安装Mariadb
关掉防火墙和selinux
启动HTTP服务
初始化数据库
查看数据库是否创建成功
修改HTTP的配置文件
浏览器打开
将以下所有目录都加上权限
最后首页效果
mysql命令
是MySQL数据库服务器的客户端工具,它工作在命令行终端中,完成对远程MySQL数据库服务器的操作。
语法
mysql(选项)(参数)
选项
-h:MySQL服务器的ip地址或主机名;
-u:连接MySQL服务器的用户名;
-e:执行mysql内部命令;
-p:连接MySQL服务器的密码。
参数
数据库:指定连接服务器后自动打开的数据库。
实例
安装php
[root@Server ~]#yum install php*
安装Mariadb
[root@Server ~]#yum install mariadb
[root@Server ~]#yum install mariadb-server
关掉防火墙和selinux
[root@Server ~]# systemctl stop firewalld.service
[root@Server ~]# setenforce 0
启动HTTP服务
[root@Server ~]# systemctl start httpd
初始化数据库
[root@Server ~]# mysql_secure_installation --初始化数据库
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
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? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
[root@Server ~]# mysql -u root -p ---选择root用户登录数据库
Enter password:
MariaDB [(none)]> create database luntan; --创建luntan数据库
查看数据库是否创建成功
切换到mysql数据库查看root用户的密码是否有设置
修改HTTP的配置文件
[root@Server upload]# vim /etc/httpd/conf.d/vhosts.conf
<VirtualHost 192.168.221.136:8909>
#精确定位
DocumentRoot /luntan
#服务器主机命名
ServerName 192.168.221.136
</VirtualHost>
<Directory /luntan>
AllowOverride none
Require all granted
</Directory>
浏览器打开
http://192.168.221.136:8909/upload
打开之后发现以下的目录都不可写或者不存在,这是由于没有权限而导致的
将以下所有目录都加上权限
[root@Server upload]# chmod o+w ./config/ ./data/ uc_client/ uc_server/ -R
输入数据库等信息就安装成功了
点击首页发现会有一个提示删除在此目录下的index.php文件
[root@Server install]# pwd
/luntan/upload/install
[root@Server install]# ls
data include index.php static
[root@Server install]# rm index.php
rm:是否删除普通文件 'index.php'?y