Some MySQL Admin Stuff

make sure it’s running
ps -ef | grep mysql

Creating MySQL DB

HOWTO on creating MySQL DBs
mysql -u root -p
# Enter your root password
Now, inside MySQL shell
mysql>create database cafecenter;
Query OK, 1 row affected (0.00 sec)
mysql>show databases;
| Database |
| database |
| mysql |
| cafecenter|
| test |
4 rows in set (0.01 sec)
Create a username/password that has at least the following privileges for the database: SELECT, INSERT, UPDATE, DELETE”
mysql> use mysql
mysql> GRANT ALL ON database_name TO manager@localhost IDENTIFIED BY “Contract$$$”;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
To work with a single database:
mysql> use DATABASENAME;
mysql> show tables;
mysql> select * from TABLENAME;
Import a dump file into database after uploaded it onto the server
mysql -p -h localhost cafecenter < /var/www/html/install/rayzz_new.sql
Useful Commands:
$ mysqldump db_name my_table
$ mysqldump db_name my_table > output.sql
$ mysqldump –no-data db_name my_table > dump_table_name.sql
$ mysqldump –add-drop-table db_name my_table > dump_table_name.sql
$ mysqladmin create db_name
$ mysqladmin drop db_name
$ mysqladmin flush-privileges
$ mysqladmin ping
$ mysqladmin reload
$ mysqladmin kill ps_id,ps_id…
$ mysqladmin –user=root shutdown
$ mysqladmin variables
$ mysqlimport db_name file_name …
$ safe_mysqld
$ myisamchk table_name.MYI

Leave a Reply

Your email address will not be published. Required fields are marked *