1、安装mysql
sudo apt-get install mysql-server sudo apt-get install mysql-client sudo apt-get install libmysqlclient-dev
2、查询是否安装成功
sudo netstat -tap | grep mysql
如下图所示,表示安装成功
编辑mysql配置文件,注释掉“bind-address = 127.0.0.1”
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf #bind-address = 127.0.0.1
使用root进入mysql命令行,执行如下2个命令,示例中mysql的root账号密码:123456
mysql -u root -p123456
mysql 赋给root用户权限 grant all privileges on
grant all on *.* to root@‘%‘ identified by ‘root‘ with grant option;
flush privileges;
刷新flush privileges;然后重启mysql,通过/etc/init.d/mysql restart命令
/etc/init.d/mysql restart -- 重启Mysql
创建一个数据库:snailblog
创建用户:tinywan_user,并使用snailblog数据库
grant all on snailblog.* to ‘tinywan_user‘ identified by ‘test123456‘;
tinywan_user 登录后的看到的数据库
MySQL学习笔记(一)Ubuntu16.04中MySQL安装配置
原文:http://www.cnblogs.com/tinywan/p/6641780.html