ubuntu安装mysql

安装mysql

sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev

修改ip地址

修改/etc/mysql/mysql.conf.d/mysqld.cnf中的bind-address           = 127.0.0.1 为 bind-address            = 0.0.0.0

登录权限

mysql -u root -p #ubuntu帐号密码
DROP USER 'root'@'localhost'; #删除mysql本地帐号root
CREATE USER 'root'@'%' IDENTIFIED BY '123456'; #创建mysql帐号密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;#赋与帐号所有库的权限
FLUSH PRIVILEGES;

 

设置密码

apt-get install libmysqlclient-dev

netstat -tap |grep mysql

use mysql;

创建用户myuser密码为password,并赋与远程操作mydb的所有权限。

grant all on mydb.* to myuser@'%' identified by 'password' with grant option;

赋与myuser访问mydb2的查询权限

grant select on mydb2.*  to myuser;

或者

grant all privileges on *.* to myuser@'192.168.1.100' identified by 'password' with grant option;

flush privileges;

posted @ 2017-05-10 10:20  traits  阅读(220)  评论(0编辑  收藏  举报