LINUX常用命令

关闭服务器    sh shutdown.sh启动服务器    sh startup.sh查看实时日志  tail -f ../logs/catalina.out 启动系统并查看日志  ./startup.sh && tail -f ../logs/catalina.out查看运行的服务器  ps -ef|grep tomcat            ps -ef|grep java杀进程  kill -9 28014查看iptables  more /etc/sysconfig/iptables导出数据库 mysqldump -uroot -proot icpip >d:\icpip.sql导入数据库 mysql -uroot -proot -h127.0.0.1 icpipbackupfile.sql

备份MySQL数据库为带删除表的格式

备份MySQL数据库为带删除表的格式,能够让该备份覆盖已有数据库而不需要手动删除原有数据库。

mysqldump -–add-drop-table -uusername -ppassword databasename > backupfile.sql

直接将MySQL数据库压缩备份

mysqldump -hhostname -uusername -ppassword databasename | gzip > backupfile.sql.gz

备份MySQL数据库某个(些)表

mysqldump -hhostname -uusername -ppassword databasename specific_table1 specific_table2 > backupfile.sql

同时备份多个MySQL数据库

mysqldump -hhostname -uusername -ppassword –databases databasename1 databasename2 databasename3 > multibackupfile.sql

仅仅备份数据库结构

mysqldump --no-data  --databases ahqxt -uroot -pahqxt123 -h172.16.10.165 > /home/qxt/dataSh.sql ;

2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION

//赋予任何主机访问数据的权限

GRANT ALL PRIVILEGES ON *.* TO  'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO  'mysql'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'%'IDENTIFIED BY 'os_mysql' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'IDENTIFIED BY '123456' WITH GRANT OPTION;

如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

3、mysql>FLUSH PRIVILEGES

//修改生效

4、mysql>EXIT

你可能感兴趣的:(LINUX常用命令)