Shell操作MySQL方法
方式一:# mysql -uroot-h 127.0.0.1-p
-u username
-hhost_ip
-p“new_pass”
-D db_name //指定直接进入的数据库
-e“sql_language” //直接在交互中直接执行SQL语句
例如: mysql-uroot-hlocalhost-pmypass-Dmysql-e“SELECT user,host,passwordfromuser;”
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
方式二:批处理模式
# mysql -uroot .......< mysql.sql
例如:
mysql.sql:
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
#mysql-uroot -hlocalhost-proot<mysql.sql
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
方式三:
mysql > source/path/to/mysql.sql
页:
[1]