You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: guides/ecto.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Newly generated Phoenix projects include Ecto with the PostgreSQL adapter by def
16
16
17
17
Ecto also provides support for other databases and it has many learning resources available. Please check out [Ecto's README](https://github.com/elixir-ecto/ecto) for general information.
18
18
19
-
This guide assumes that we have generated our new application with Ecto integration and that we will be using PostgreSQL. The introductory guides cover how to get your first application up and running. For instructions on switching to MySQL, please see the [Using MySQL](#using-mysql) section.
19
+
This guide assumes that we have generated our new application with Ecto integration and that we will be using PostgreSQL. The introductory guides cover how to get your first application up and running. For using other databases, see the [Using other databases](#using-other-databases) section.
20
20
21
21
## Using the schema and migration generator
22
22
@@ -507,9 +507,9 @@ There is quite a bit more that Ecto can do and we've only barely scratched the s
507
507
508
508
In our [contexts guide](contexts.html), we'll find out how to wrap up our Ecto access and business logic behind modules that group related functionality. We'll see how Phoenix helps us design maintainable applications, and we'll find out about other neat Ecto features along the way.
509
509
510
-
## Using MySQL
510
+
## Using other databases
511
511
512
-
Phoenix applications are configured to use PostgreSQL by default, but what if we want to use MySQL instead? In this guide, we'll walk through changing that default whether we are about to create a new application, or whether we have an existing one configured for PostgreSQL.
512
+
Phoenix applications are configured to use PostgreSQL by default, but what if we want to use another database, such as MySQL? In this section, we'll walk through changing that default whether we are about to create a new application, or whether we have an existing one configured for PostgreSQL.
513
513
514
514
If we are about to create a new application, configuring our application to use MySQL is easy. We can simply pass the `--database mysql` flag to `phx.new` and everything will be configured correctly.
515
515
@@ -521,7 +521,7 @@ This will set up all the correct dependencies and configuration for us automatic
521
521
522
522
If we have an existing application, all we need to do is switch adapters and make some small configuration changes.
523
523
524
-
To switch adapters, we need to remove the Postgrex dependency and add a new one for Myxql instead.
524
+
To switch adapters, we need to remove the Postgrex dependency and add a new one for MyXQL instead.
525
525
526
526
Let's open up our `mix.exs` file and do that now.
527
527
@@ -549,9 +549,9 @@ Next, we need to configure our adapter to use the default MySQL credentials by u
549
549
550
550
```elixir
551
551
config :hello_phoenix, HelloPhoenix.Repo,
552
-
username:"root",
553
-
password:"",
554
-
database:"hello_phoenix_dev"
552
+
username:"root",
553
+
password:"",
554
+
database:"hello_phoenix_dev"
555
555
```
556
556
557
557
If we have an existing configuration block for our `HelloPhoenix.Repo`, we can simply change the values to match our new ones. You also need to configure the correct values in the `config/test.exs` and `config/runtime.exs` (formerly `config/prod.secret.exs`) files as well.
0 commit comments