ubuntu 安装mysql
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-14-04
- sudo apt-get update
- sudo apt-get install mysql-server
设置mysql
http://www.wottageek.com/2015/07/how-to-set-up-mysqljdbc-on-ubuntu.html
安装:
sudo apt-get install mysql-client sudo apt-get install libmysql-java
设置mysql-connector的环境变量:
将export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar加到.bashrc文件中
如何启动mysql:sudo service mysql start
如何看mysql运行状态:service mysql status
如何登录mysql: mysql -u root -p 然后输入密码..
远程登录:
1、修改 /etc/mysql/my.conf 将bind-address 改为 0.0.0.0或者注释掉,如果只允许服务器本机访问改为127.0.0.1
2、授予权限:
如何给某个ip添加mysql的权限:GRANT ALL PRIVILEGES on *.* to root@'yourLoginIp' identified by '123456';(把yourLoginIp改为%表示登录ip不受限制)注意执行语句后要加上;接着执行 flush privileges; 可以立即生效,或者执行 sudo service mysql restart也可以生效.
3、移除登录权限:如何移除某个ip登录mysql的权限:REVOKE ALL PRIVILEGES ON test.* FROM 'jane'@'56.44.3.24';