MYSQL常用经典命令
1.停止mysql
kill -9 `ps -ef | grep mysqld_safe| grep -v grep| awk '{print $2}'`
kill -9 `ps -ef | grep 'mysqld' | grep -v grep| awk '{print $2}'`
2.启动mysql
cd /usr/local/mysql-5.4.1-beta-linux-x86_64-glibc23
/bin/sh bin/mysqld_safe --user=mysql &
3.启动apache
cd /usr/local/apache-tomcat-5.5.27/bin
./startup.sh
停止apache
cd /usr/local/apache-tomcat-5.5.27/bin
./shutdown.sh
4.给指定IP增加访问权限。
Use mysql
Select * from user
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections |
'10.137.6.44', 'mysql', '*E74858DB86EBA20BC33D0AECAE8A8108C56B17FA', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', 'BINARY, 0 Bytes', 'BINARY, 0 Bytes', 'BINARY, 0 Bytes', 0, 0, 0, 0
insert into user values ('10.137.6.44', 'mysql', '*E74858DB86EBA20BC33D0AECAE8A8108C56B17FA', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', 'BINARY, 0 Bytes', 'BINARY, 0 Bytes', 'BINARY, 0 Bytes', 0, 0, 0, 0);
5.导出数据
mysqldump -u mysql --password=mysql --default-character-set=gbk webdb > webdb.sql
6.导入数据
mysql -u mysql --password=mysql --default-character-set=gbk webdb < mcip_2011-09-01.sql