1er commit
De la docs au format Mkdocs
This commit is contained in:
109
docs/Divers/wp-cli/wp_db.md
Normal file
109
docs/Divers/wp-cli/wp_db.md
Normal file
@@ -0,0 +1,109 @@
|
||||
# wp db
|
||||
|
||||
Aide:
|
||||
|
||||
```bash
|
||||
$ wp help db
|
||||
```
|
||||
|
||||
```bash
|
||||
NAME
|
||||
|
||||
wp db
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Performs basic database operations using credentials stored in wp-config.php.
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
wp db <command>
|
||||
|
||||
SUBCOMMANDS
|
||||
|
||||
check Checks the current status of the database.
|
||||
clean Removes all tables with `$table_prefix` from the database.
|
||||
cli Opens a MySQL console using credentials from wp-config.php
|
||||
columns Displays information about a given table.
|
||||
create Creates a new database.
|
||||
drop Deletes the existing database.
|
||||
export Exports the database to a file or to STDOUT.
|
||||
import Imports a database from a file or from STDIN.
|
||||
optimize Optimizes the database.
|
||||
prefix Displays the database table prefix.
|
||||
query Executes a SQL query against the database.
|
||||
repair Repairs the database.
|
||||
reset Removes all tables from the database.
|
||||
search Finds a string in the database.
|
||||
size Displays the database name and size.
|
||||
tables Lists the database tables.
|
||||
```
|
||||
|
||||
Optimiser la bdd:
|
||||
|
||||
```bash
|
||||
$ wp db optimize
|
||||
wordpress4.wp_comments
|
||||
note : Table does not support optimize, doing recreate + analyze instead
|
||||
status : OK
|
||||
wordpress4.wp_cptch_images
|
||||
note : Table does not support optimize, doing recreate + analyze instead
|
||||
status : OK
|
||||
.../...
|
||||
Success: Database optimized.
|
||||
```
|
||||
|
||||
Vérifier la bdd:
|
||||
|
||||
```bash
|
||||
$ wp db check
|
||||
wordpress4.wp_cntctfrm_field OK
|
||||
wordpress4.wp_commentmeta OK
|
||||
wordpress4.wp_comments OK
|
||||
wordpress4.wp_cptch_images OK
|
||||
.../...
|
||||
Success: Database checked.
|
||||
```
|
||||
|
||||
Réparer la bdd:
|
||||
This command only works on database tables that use the MyISAM storage engine. It does not work on InnoDB tables.
|
||||
|
||||
```bash
|
||||
$ wp db repair
|
||||
wordpress4.wp_options
|
||||
note : The storage engine for the table doesn't support repair
|
||||
wordpress4.wp_postmeta
|
||||
note : The storage engine for the table doesn't support repair
|
||||
.../...
|
||||
Success: Database repaired.
|
||||
```
|
||||
|
||||
Créer une sauvegarde de la base de bonnée de WordPress:
|
||||
|
||||
```bash
|
||||
$ wp db export
|
||||
Success: Exported to 'wordpress4-2018-08-11-d930b79.sql'.
|
||||
```
|
||||
|
||||
Tester une requête:
|
||||
|
||||
```bash
|
||||
$ wp db query "SELECT * FROM wp_options"
|
||||
```
|
||||
|
||||
Ouvrir une console MySQL:
|
||||
|
||||
```bash
|
||||
$ wp db cli
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MariaDB connection id is 407
|
||||
Server version: 10.3.8-MariaDB Homebrew
|
||||
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MariaDB [wordpress4]>
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user