ubuntu18.04
安装mysql-serverapt-get install mysql-server
查看是否安装成功并启动netstat -tap | grep mysql
mysql在安装完成后自动启动,root账号密码为系统root密码mysqladmin --version 查看mysql版本sudo service mysql status 查看mysql状态sudo service mysql start 启动mysql服务sudo service mysql stop 停止mysql
使用root登录mysql:shell>mysql -u root -p
添加其他账号并授权:mysql>create user 'admin'@'localhost' identified by 'pwd';mysql>grant all privileges on *.* to 'admin'@'localhost' with grant option;指定域名,指定权限,指定databasemysql>create user 'dever'@'%.xxx.com' identified by 'pwd';mysql>grant select,delete,drop,insert,update,create on your_database.* to 'dever'@'%.xxx.com';
查看用户 select host,user from user;
开启mysql远程访问:修改mysql配置文件:vi /etc/mysql/mysql.conf.d/mysqld.cnf把其中bind-address = 127.0.0.1注释掉:
登陆mysql修改权限mysql>grant all on *.* to root@'%' identified by 'pwd';flush privileges;service mysql restart
过程中如果需要用到其他软件,可通过apt-get install获取