# MySQL Tips

#### Import SQL via Command Line

```
mysql -u root -p database_name < file.sql
```

#### Export SQL via Command Line

```
mysqldump -u root -p database_name > database.sql
```

#### Import .sql.gz file via Command Line

```
gunzip < production.sql.gz | mysql -h hosturl -u username -p db_name
```

#### Import sql.gz file via Command Line with progress bar

```
sudo apt-get install pv
pv mydump.sql.gz | gunzip | mysql -u root -p
```

#### Find most common value in table

```
SELECT column, COUNT(*) AS magnitude 
FROM table 
GROUP BY column 
ORDER BY magnitude DESC
LIMIT 1
```


---

# Agent Instructions: 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:

```
GET https://charliepage.gitbook.io/book/mysql-tips.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
