简体   繁体   English

如何将laravel项目与xampp数据库连接

[英]How to connect laravel project with xampp database

I have a basic issue in laravel setup. 我在laravel设置中有一个基本问题。 I have setup laravel 5.5 using php7.0(cli) and for artisan migrate I have install the mysql server on my system (I have already xampp on my system) so now my Laravel project access the mysql cli (not xampp which I access with phpmyadmin) how can I connect my laravel with xampp database. 我已经使用php7.0(cli)设置laravel 5.5并且对于工匠迁移我已经在我的系统上安装了mysql服务器(我已经在我的系统上安装了xampp)所以现在我的Laravel项目访问mysql cli(不是我访问的xampp) phpmyadmin)如何将我的laravel与xampp数据库连接起来。

currently its direct configure with cli php and mysql-server 目前它直接配置cli php和mysql-server

Thanks 谢谢

You have .env file in your project root folder. 您的项目根文件夹中有.env文件。 There you can edit: 在那里你可以编辑:

 DB_CONNECTION=mysql
 DB_HOST=127.0.0.1
 DB_PORT=3306
 DB_DATABASE=database_name
 DB_USERNAME=root
 DB_PASSWORD=

By default, XAMPP root username is root , there is no password and port is 3306. Obviously, you have to start MySQL in XAMPP control panel. 默认情况下,XAMPP root用户名是root ,没有密码,端口是3306.显然,你必须在XAMPP控制面板中启动MySQL。

go to .env file in your project root folder,There you can edit: 转到项目根文件夹中的.env文件,在那里你可以编辑:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=testdatagym
DB_USERNAME=root
DB_PASSWORD=

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM