Ubuntu MySQL安装

step1:安装

  sudo apt-get install mysql-server

  sudo apt isntall mysql-client

  sudo apt install libmysqlclient-dev

检查是否安装成功:

  sudo netstat -tap | grep mysql

step2:重启

  sudo service mysql restart

step3:登录

  mysql -u root - p

step4:授权

  grant all on *.* to root@'%' identified by '你的密码' with grant option;

  flush privileges;

step5:远程连接问题

  sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

  注释 bind-address = 127.0.0.1

扩展:

mysql -u root -p
insert into mysql.user(Host,User,Password values(‘localhost’,'jee’,password(‘jee’)); 
flush privileges;
grant select,insert,update,delete,create,drop on db.employee to jee@10.10.10.10 identified by ‘123′;

给来自10.10.10.10的用户jee分配可对数据库db的employee表进行
select,insert,update,delete,create,drop等操作权限,并设定口令为123;

grant all privileges on db.* to jee@10.10.10.10 identified by ‘123′;
给来自10.10.10.10的用户jee分配可对数据库db所有表进行所有操作的权限,并设定口令为123;
grant all privileges on *.* to jee@10.10.10.10 identified by ‘123′;
给来自10.10.10.10的用户jee分配可对所有数据库所有表进行所有操作的权限,并设定口令为123;
grant all privileges on *.* to jee@localhost identified by ‘123′;
给本机用户jee分配可对所有数据库所有表进行所有操作的权限,并设定口令为123;
 
 
 
原文地址:https://www.cnblogs.com/m-zone/p/9081107.html