> For the complete documentation index, see [llms.txt](https://abi.gitbook.io/net-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abi.gitbook.io/net-core/4.-creando-tu-primer-servicio/creando.md).

# 4.1 Crear las base de datos y los usuarios en MySQL

Primero vamos a crear la base de datos y los usuarios para conectarnos la base de datos.

{% hint style="warning" %}
Por seguridad NO se recomienda que el usuario root  (MySQL) o sa (SQL Server) se conecte a la base de datos desde tu aplicación.
{% endhint %}

&#x20;En mi caso creare un usuario administrador para crear las tablas en la base de datos y un usuario de solo lectura con acceso a solo realizar selects, inserts, updates y deletes. Desde los servicios REST nos conectaremos con el usuario de solo lectura.

### Creando la base de datos y los usuarios en MySQL

Primero vamos a crear la base de datos.

1. Con el editor de MySQL tecleamos el siguiente comando para crear la base de datos.

```plsql
CREATE DATABASE caduca CHARACTER SET utf8 COLLATE utf8_general_ci;
```

2\. Crear un usuario administrador&#x20;

```plsql
CREATE USER 'AdminCaduca'@'localhost' IDENTIFIED BY 'StKRV6MR6A'; 
GRANT ALL PRIVILEGES ON caduca.* TO 'AdminCaduca'@'localhost'
```

3\. Crear un usuario de solo lectura.

```plsql
CREATE USER 'SistemaCaduca'@'localhost' IDENTIFIED BY 'xADcUaP5cs'; 
GRANT SELECT,INSERT,UPDATE,DELETE ON caltic.* TO 'SistemaCaduca'@'localhost';
```

El script completo es:

```sql
CREATE DATABASE caduca CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'AdminCaduca'@'localhost' IDENTIFIED BY 'StKRV6MR6A'; 
GRANT ALL PRIVILEGES ON caduca.* TO 'AdminCaduca'@'localhost'
CREATE USER 'SistemaCaduca'@'localhost' IDENTIFIED BY 'xADcUaP5cs'; 
GRANT SELECT,INSERT,UPDATE,DELETE ON caltic.* TO 
'SistemaCaduca'@'localhost';
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://abi.gitbook.io/net-core/4.-creando-tu-primer-servicio/creando.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
