All language subtitles for 1.setting-up-the-database

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Hello again.

My name is Mateo,

and welcome back to the course about Laravel framework fundamentals.

In this module, we'll connect our Laravel app to some SQL database,

but why did I say some SQL database?

Well because it's up to you which database system you will choose to use.

Check out the section in the documentation about getting started with databases.

Here is the list of all currently supported database systems in Laravel.

You can pick any one of these because we'll not work with them directly.

Laravel will provide us with an interface that will

communicate with the database,

instead of us. But before you pick your favorite database system,

make sure that you checked which version of the software is supported.

Since I already have XAMPP installed on my local setup,

I will use the MySQL database that comes with the bundle.

You can do that too, or you can just install MySQL on your system separately.

The most important thing is that you have one of these database

management systems installed on your computer,

but make sure that you know how to install them properly.

If you're not really familiar with that process,

you can install XAMPP like me and follow along.

I can start up the MySQL Server by simply clicking on the Start button.

If you are configuring MySQL and PHP yourself,

don't forget to install the PHP MySQL connector package.

After this is done, we can connect the database to our Laravel application.

Click on the config directory and find the database PHP file.

This is the one.

This file tells our application how to connect to the database.

Here, we can see that the default database system is set to mysql,

and this is only if you didn't specify your own choice in

the DB_CONNECTION environment variable,

but what is this MySQL string referring to?

Scroll down a little bit more to find the connections array.

Each item in this array contains configuration for one

of the supported database systems.

For example, here is the configuration for the default MySQL database,

but notice that the values for these configuration properties

are also taken from the environment variables.

So if you want to connect your application to the database,

you will rarely have a need to change anything in this file.

This is because it's better to get these details from the env file since

that file won't be pushed anywhere publicly like on GitHub,

for example,

and this makes sense because if you push your project to some public repository,

you don't want to have your connection details exposed to the whole world.

Also,

every member of the development team and every environment like production or

testing will usually have different database configuration.

So to set up your database,

usually you will only need to make changes in the env file.

It is placed in the root folder of the project and it contains all of

the environment variables related to our application.

In this lesson, we are only interested in this section.

This is the DB_CONNECTION variable that declares

which database engine will be used.

So if you are using something other than MySQL,

this is where you would change that,

but this value has to be equal to one of the keys from the connections array.

Then we have the database server host, port,

the name of the database, and the credentials for the access.

If you are using XAMPP like me,

these values can be used to connect to the started MySQL Server.

I didn't change any one of the defaults,

but if you did, you can modify them here.

The default host is localhost, the port is 3306,

and the username is root, and this is okay for development purposes.

We don't want to make things more complicated.

You can set any name you want for the database,

but the standard is to give it a name of the project.

Of course, this database doesn't exist yet.

We just have the database system, but we didn't create the blog database,

so let's do that.

It is up to you on how you want to do that.

For example,

you can use the command line interface provided by your specific

database system and run the statement for creating a new database,

or you can install some graphical tool for managing databases and

create the database from there.

If you have XAMPP, that means that you also have access to phpMyAdmin,

which is a web‑based MySQL administration tool.

To use it, we also need to start the Apache Server so make sure that you do that.

In the browser, you can type in localhost/phpmyadmin.

This should open the phpMyAdmin interface,

which should look something like this.

I repeat that you can also use the MySQL command line and

type in the create database statement,

but this is just how I chose to do it here.

I will click on this new link to create a new database.

I just need to provide the database name and click on Create.

This will create a new blog database.

You can now access this new database from the list here,

but as you can see, it's already selected and it's empty,

and this is all we need to do outside of the scope of Laravel.

From this moment on,

we will not do anything with this database directly so make

sure that you installed your database system,

provided its configuration to Laravel, and created a new blog database.

You can check if you did something wrong by running the artisan DB command.

This command will open the cli of the connected database,

so if it works, that means that the connection is successfully established.

In my case, everything seems fine so I will exit the MySQL CLI.

If you get some error or you get nothing at all,

that means that something went wrong.

But don't worry, if this doesn't work,

just follow along until we start running migrations.

You will then get a specific error on why the connection is broken.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.