mysql杂记
mac:
###mysql服务
sudo /Library/StartupItems/MySQLCOM/MYSQLCOM [start | stop | restart]
###链接mysql
/usr/local/mysql/bin/mysql -u root -p123456
###修改密码
mysqladmin -u USER -p old_password new_PASSWORD
或 UPDATE user SET password=PASSWORD('123456') WHERE user='root'; FLUSH PRIVILEGES;
或 SET PASSWORD FOR root=PASSWORD('123456');
如果是空密码,似乎只能用后面2种方法
###导入sql文件
先创建database,然后 mysql -u root -p123456 test < /Users/Tom/Desktop/test.sql
###删除表
drop table XXX;
###查看表结构
show columns from 表名;
show create table 表名;