Cum se creeaza o baza de date MySQL din linia de comanda

Crearea unei baze de date din linia de comanda si adaugarea unui user cudrepturi asupra acesteia:

[root@server ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 865
Server version: 5.0.45 Source distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

Cream baza de date domeniu_test. Atentie, toate comenzile se termine cu semnul ” ; “

mysql> create database test;
Query OK, 1 row affected (0.08 sec)

Adaugam userul user la baza de date test cu toate privilegiile setand parola parola_setata:

mysql> grant all privileges on test.* to user@localhost identified by “parola_setata”;
Query OK, 0 rows affected (0.09 sec)

Reactualizam privilegiile userilor:

mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)

Comenzile sunt valabile si din phpMyAdmin.

Lasa un comentariu