Xampp相关命令

http://www.upwqy.com/details/5.html

1 启动关闭

需要切换目录:

# cd /opt/lampp/

启动 XAMPP

# ./lampp start

停止 XAMPP

# ./lampp stop

 重启 XAMPP

# ./lampp restart

2 数据库

 进入mysql

# /opt/lampp/bin/mysql -uroot -p  

xampp安装完毕后,默认数据库密码为空

Enter password: 

这里直接Enter就可以进入数据库

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.1.21-MariaDB Source distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

 

设置root用户密码

 set password for root@localhost = password('123'); 

创建用户并设置远程访问权限

MariaDB [(none)]> CREATE USER '用户名'@'%' IDENTIFIED BY '密码';

MariaDB [(none)]> GRANT ALL ON *.* TO '用户名'@'%';

MariaDB [(none)]> flush privileges;

//2017-08-19

一个实例,添加一个对某个数据库只有查询权限的用户

MariaDB [(none)]> create user 'zhangsl'@'%' identified by 'zhangsl2017';
Query OK, 0 rows affected (0.02 sec)

MariaDB [(none)]> grant select  on db_name.* to 'zhangsl'@'%';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

 

 3 配置虚拟主机

  执行 

cat /opt/lampp/etc/httpd.conf

 可以查找到以下数据

# Virtual hosts
#Include etc/extra/httpd-vhosts.conf

  xampp为我们准备了一个专用于配置虚拟主机的文件了,去掉#号以删除其注释,然后编辑/opt/lampp/etc/extra /httpd-vhosts.conf文件,此文件中xampp为我们创建了两个虚拟主机的示例,然后添加我们自己需要的虚拟主机

<VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs
    ServerName blog.upwqy.com
</VirtualHost>

DocumentRoot表示虚拟主机对应的路径,即网站目录,ServerName表示虚拟主机的访问地址,类似IIS中的主机头值。

至此,虚拟主机的设置也算是完成了。

最后我们需要在apache配置文件/opt/lampp/etc/httpd.conf中添加一下网站目录的访问权限。

<Directory "/opt/lampp/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

 

转载于:https://www.cnblogs.com/wqy415/p/6834989.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值