I have a basic issue in laravel setup. 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.
currently its direct configure with cli php and mysql-server
Thanks
You will be shown how to set up a Laravel project on a local server using the Xampp development stack on a PC. Xampp is a free and open-source cross-platform web service stack package. It is used by developers to launch PHP projects such as Laravel on their local computer in order to create and test programs locally.
Open a terminal and run the following command: composer global require laravel/installer to install Laravel globally. Once it’s done, you can create a fresh Laravel project with the laravel new command in the directory you’re in. In your terminal go to the root of your webserver (e.g.: cd C:\xampp\htdocs) and run laravel new your_project.
If you already have a Laravel project in the root of your webserver then you can skip this section and jump to the next. Open a terminal and run the following command: composer global require laravel/installer to install Laravel globally. Once it’s done, you can create a fresh Laravel project with the laravel new command in the directory you’re in.
Once it’s done, you can create a fresh Laravel project with the laravel new command in the directory you’re in. In your terminal go to the root of your webserver (e.g.: cd C:\xampp\htdocs) and run laravel new your_project. Now dream a custom domain for your project. We will use laravel.test in this tutorial.
In your terminal go to the root of your webserver (e.g.: cd C:\xampp\htdocs) and run laravel new your_project. Now dream a custom domain for your project. We will use laravel.test in this tutorial. Go to the following folder C:\Windows\System32\drivers\etc and open the hosts file, paste the following line and save it.
You have .env
file in your project root folder. 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.
Go to .env file in your project root folder, there you can edit:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=testdatagym
DB_USERNAME=root
DB_PASSWORD=
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With