1.
sudo netstat -tap | grep mysql #确保系统已安装并启动MySQL
2.
sudo apt-get install mysql-workbench #安装mysql-workbench
3.
本地搜索mysql-workbench,创建新的连接
!出现问题,如下:
Cannot Connect to Database Server
Your connection attempt failed for user ‘root’ from your host to server at
127.0.0.1:3306:Can’t connect to mysql server on ‘127.0.0.1’(10061)
Please:
- Check that mysql is running on server 127.0.0.1
- Check that mysql is running on port 3306 (note: 3306 is the default, but this can
be changed) - Check the root has rights to connect to 127.0.0.1 from your address (mysql rights
define what clients can connect to the server and from which machines) - Make sure you are both providing a password if needed and using the correct
password for 127.0.0.1 connecting from the host address you’re connecting from
百度搜索到 http://stackoverflow.com/questions/7864276/cannot-connect-to-database-server-mysql-workbench 很有帮助,但大多是Windows系统的解决方法,正在逐一尝试。
其他命令:
Linux下查看mysql、apache是否安装,并卸载。
指令 ps -ef|grep mysql 得出结果
root 17659 1 0 2011 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –socket=/var/lib/mysql/mysql.sock –log-error=/var/log/mysqld.log –pid-file=/var/run/mysqld/mysqld.pid
mysql 17719 17659 0 2011 ? 03:14:57 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysqld.pid –skip-external-locking –socket=/var/lib/mysql/mysql.sock
usr/bin/mysql 是指:mysql的运行路径
var/lib/mysql 是指:mysql数据库文件的存放路径
usr/lib/mysql 是指:mysql的安装路径