Laravel 上传至服务器后,打开首页提示:
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from sessions
where id
= nCRogPQ5Hyhf42Y1eBsfYH4zYFGEbCYsh8E9KeGP limit 1)
139856800 可以加我的QQ交流
我也在新疆,哈哈,难兄难弟!用搬瓦工吧,歹歹的
一开始我也是想要代码,后来觉得还是跟着敲代码还是很有必要的,代码你可以复制粘贴,但是你下次自行处理问题,就不知道是哪里的问题了,现在Laravist出的知乎课程,我都是一步一步跟着敲代码,我觉得很受用,是我个人的观点,如有得罪,请多包涵。
.dev 的还是不行,数据库通过33060端口可以正常连接
感觉我和homestead无缘了,哈哈
vagrant@homestead:~$ ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:c3:0a:85
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fec3:a85/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:720 errors:0 dropped:0 overruns:0 frame:0
TX packets:485 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:77261 (77.2 KB) TX bytes:65437 (65.4 KB)
enp0s8 Link encap:Ethernet HWaddr 08:00:27:04:93:f9
inet addr:192.168.10.10 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe04:93f9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:519 (519.0 B) TX bytes:1296 (1.2 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:50 errors:0 dropped:0 overruns:0 frame:0
TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:26161 (26.1 KB) TX bytes:26161 (26.1 KB)
这个是我在homestead里运行ifconfig后的显示结果
192.168.10.10 homestead.app
是我的hosts文件,就一行
我可以ssh登录进去,也可以ping 通 192.168.10.10
但是我退出,会显示:
vagrant@homestead:~/Code/Laravel$ logout
Connection to 127.0.0.1 closed.
打开homestead.app 会显示本地localhost页面
$ vagrant reload --provision
==> homestead-7: Attempting graceful shutdown of VM...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 8000 (host) (adapter 1)
homestead-7: 443 (guest) => 44300 (host) (adapter 1)
homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
homestead-7: SSH auth method: private key
==> homestead-7: Machine booted and ready!
==> homestead-7: Checking for guest additions in VM...
==> homestead-7: Setting hostname...
==> homestead-7: Configuring and enabling network interfaces...
==> homestead-7: Mounting shared folders...
homestead-7: /vagrant => D:/Homestead
homestead-7: /home/vagrant/Code => C:/Users/江政昊/Code
==> homestead-7: Running provisioner: file...
==> homestead-7: Running provisioner: shell...
homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
homestead-7: Running: D:/Users/JOHNHO~2/AppData/Local/Temp/vagrant-shell20170107-20148-1bh5sfq.sh
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Site: homestead.app
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Restarting Nginx
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating MySQL Database: homestead
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Postgres Database: homestead
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Clear Variables
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Update Composer
==> homestead-7: You are already using composer version 1.3.0 (stable channel).
==> homestead-7: Running provisioner: shell...
homestead-7: Running: D:/Users/JOHNHO~2/AppData/Local/Temp/vagrant-shell20170107-20148-uz1pkj.sh
配置了:
192.168.10.10 homestead.app
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
但是在本机打开指向的域名,会跳转到本机的:127.0.0.1的首页