mysql in linux

sudo apt-get install mysql-server
mysql -u root -p

在windows中用HeidiSQL连mysql时报"Can’t connect to MySQL server on..."
解决:sudo apt-get install mysql-client,重启mysql,不管用。查到 资料,应该是MySQL Server绑定了本地地址。
打开/etc/mysql/my.cnf,找到 bind-address = 127.0.0.1,去除IP地址绑定,把它改为: bind-address = 0.0.0.0 然后重启MySQL。

又报"host is not allowed to connect to this MySQL"
解决:
mysql>use mysql;
mysql>show tables; (确认一下表user是否存在)
mysql>update user set host='%' where host='loalhost' and user='root';
重启mysql
当然,也可通过授权:GRANT ALL PRIVILEGES ON *.* TO......

查看编码
show variables like 'character%';




查看mysql版本的几种办法:
1,在终端下:mysql -V
2,在mysql中:mysql> status;
3,mysql> select version();

你可能感兴趣的:(mysql in linux)