mysql小知识

启动与停止mysql

windows_cmd        启动: net start mysql 

                   停止 : net stop mysql 

linux              启动 : service mysql start或 /etc/inint.d/mysqld start

                   停止 : service mysql stop或 /etc/inint.d/mysqld stop

登陆客户端

 mysql -uroot -proot -hlocalhost
-u后面是用户名 -p后面是密码 -h后面是主机名,可以省略,默认是localhost

允许远程访问mysql

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

导入和导出sql文件

导入:source D:/test.sql 或mysql -uroot -proot test < /data/test.sql
导出:mysqldump -uroot -proot test > /opt/test.sql

远程访问mysql(ubuntu) 错误代码:2003

vim /etc/mysql/my.cnf
将 bind-address =127.0.0.1 这一行注释掉

 

 

 

 

 

 

 

 

                   

posted @ 2015-08-05 23:44  sflik  阅读(163)  评论(0编辑  收藏  举报