MySQL: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
 
(29 dazwischenliegende Versionen von 6 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
=Installation=
*[[Mysql allgmein]]
root@asuka:~# aptitude install mysql-server mysql-client
*[[Mysql an Grafana]]
 
*[[Mysql Password reset]]
=Login=
*[[Mysql Kompakt]]
root@asuka:~# mysql --user root -h localhost -p
*[[Mysql Logging]]
Enter password: XXXXXX
*[[Mysql ODBC]]
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.1.41-3ubuntu12 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
 
=Status überprüfen=
mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (i486) using readline 6.1
Connection id: 48
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.41-3ubuntu12 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Client characterset: latin1
Server characterset: latin1
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 41 min 4 sec
Threads: 1  Questions: 207  Slow queries: 0  Opens: 476  Flush tables: 1  Open tables: 64  Queries per second avg: 0.84
--------------
 
=Hilfe aufrufen=
mysql> help contents;
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the following
categories:
    Account Management
    Administration
    Compound Statements
    Data Definition
    Data Manipulation
    Data Types
    Functions
    Functions and Modifiers for Use with GROUP BY
    Geographic Features
    Language Structure
    Plugins
    Table Maintenance
    Transactions
    User-Defined Functions
    Utility
 
=Datenbanken anzeigen=
mysql> show databases;
+--------------------+
| Database          |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)
 
=Datenbank auswählen=
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
 
=Datenbank erstellen=
mysql> create database world;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database          |
+--------------------+
| information_schema |
| mysql              |
| world              |
+--------------------+
3 rows in set (0.00 sec)
 
=Datenbank mit Daten von Backup füllen=
root@asuka:~# mysql world < world.sql  -p
Enter password:
 
=Datenbank wechseln=
mysql> use world
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
 
=Tabellen einer Datenbank anzeigen=
mysql> show tables;
+-----------------+
| Tables_in_world |
+-----------------+
| City            |
| Country        |
| CountryLanguage |
+-----------------+
3 rows in set (0.00 sec)
 
=Tabellenbeschreibung anzeigen=
mysql> describe City;
+-------------+----------+------+-----+---------+----------------+
| Field      | Type    | Null | Key | Default | Extra          |
+-------------+----------+------+-----+---------+----------------+
| ID          | int(11)  | NO  | PRI | NULL    | auto_increment |
| Name        | char(35) | NO  |    |        |                |
| CountryCode | char(3)  | NO  |    |        |                |
| District    | char(20) | NO  |    |        |                |
| Population  | int(11)  | NO  |    | 0      |                |
+-------------+----------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

Aktuelle Version vom 11. März 2023, 09:20 Uhr