How to add user and database in mysql
from now, i must add user and database manually in mysql server. Before, i ussualy use phpmyadmin for add it. And today, i want to write down step by step adding user and databases in mysql manually (textmode, not using phpmyadmin or any interface).
Lets begin, Bismillahirrohmanirrohim….
i assume you already have root login.
dbserver#mysql -u root -p
Enter password: ————-> put your root password here
mysql>show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
+——————–+
3 rows in set (0.00 sec)
mysql> create database coba;
mysql> grant all on coba.* to root;
mysql> grant all on coba.* to root@localhost;
mysql> grant all on coba.* to cobauser;
mysql> grant all on coba.* to cobauser@localhost;
mysql> set password for cobauser@localhost=password(’pwdusercoba’);
mysql> quit
Now, lets upload your sql table to your databases . you must dump your sql table first ( iam not explain how to dump it in here). And upload to your directory.
make sure your sql-dump-file already upload to your directory.
dbserver# cd /home/youruser/
dbserver# ls
sqlname.sql ——> its your sql-dump-file
put your .sql to database,
dbserver# mysql -u root -p coba < sqlname.sql
password:
dbserver#
lets check,
dbserver#mysql -u root -p
Enter password:
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| coba |
| mysql |
| test |
+——————–+
4 rows in set (0.00 sec)
mysql> use coba;
mysql> show table;
blabla bla…..
( it must be show your table here)
mysql> quit
September 13th, 2009 at 10:58 pm
mantep sakjane mas.. but I’m Confusng..