mysql命令集合

问题一、

登录:

# mysql -u root -p
Enter password: 

报错:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

查看配置文件:

# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock  ##mysql.sock确实存在/tmp目录下

user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

解决方法:

ln -s /tmp/mysql.sock  /var/lib/mysql/mysql.sock

再次尝试登录成功!


查询命令

 show table status from dbname where name='tablename';  查看某个表的存储引擎

 show processlist 显示mysql查询进程 ##如果有 SUPER 权限,则可以看到全部的线程,否则,只能看

 到自己发起的线程(这是指,当前对应的MySQL帐户运行的线程)


你可能感兴趣的:(mysql,数据库)