当前位置:网站首页>ubuntu14安装MySQL并配置root账户本地与远程访问
ubuntu14安装MySQL并配置root账户本地与远程访问
2022-07-01 18:44:00 【无极小卒】
安装
Ubuntu14 apt安装默认安装mysql5.5版本。
1、sudo su #切换管理员用户
2、sudo apt-get install mysql-server #apt安装
3、在安装过程中会让您进行确认,输入y即可。

4、接下来会弹出窗口让你输入root用户的密码,输入后一定要记住,否则比较麻烦。然后紧接着确认输入你刚才输入的root用户的密码。
第一次输入:

第二次输入:

5、安装完成

配置远程访问
首先请确保您的服务器出入站规则已经开放了3306端口。
1、进入mysql安装目录 命令:cd /etc/mysql
2、查看mysql文件夹下的文件 命令:ls
![]()
3、修改my.cnf文件
命令1:vim my.cnf #编辑my.cnf文件

命令2:按i进行插入编辑。
在[mysqld]后面任意一行添加“skip-grant-tables”(注:skip-grant-tables:不启动grant-tables授权表。它的作用是MYSQL服务器不加载权限判断,mysql中的任何用户都可以访问数据库)。
另外还必须将 bind-address = 127.0.0.1 修改为 bind-address = 0.0.0.0(注:这是将访问数据库的主机ip设置为任意ip的意思)

命令3:先按esc退出编辑模式
命令4:输入 :wq 回车保存退出。
4、重启mysql
命令:service mysql restart (mysql5.5的重启命令 ,如果您是mysql5.7或以上版本请用service mysqld restart)
5、登录mysql
命令:mysql -u root -p
6、刷新权限,如不刷新会,在授权的时候报错误 ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement。重要
命令:flush privileges;
7、授权
命令:grant all privileges on *.* to [email protected]'%' identified by "password"; (授权添加远程访问root用户的命令)
8、查看 user=root,host=% 是否成功添加到授权表中。
命令:select user,host,password from mysql.user;

9、统一修改root用户的密码,上一步添加的root用户密码是授权的时候根据上一步by 后面的值生成的hash值。
命令:
1)use mysql;
2)update user set password=password("123456") where user="root";(MySQL5.5的设置密码,MySQL5.7及以上请使用mysql> update user set authentication_string=password("123456") where user="root";)

10、刷新权限 重要
命令:flush privileges;
11、退出
命令:quit;
远程客户端连接

边栏推荐
- English语法_形容词/副词3级 -注意事项
- Intensive cultivation of channels for joint development Fuxin and Weishi Jiajie held a new product training conference
- Lake Shore低温恒温器的氦气传输线
- Lumiprobe 活性染料丨吲哚菁绿说明书
- Chinese and English instructions human soluble advanced glycation end products receptor (sRAGE) ELISA Kit
- 【直播预约】数据库OBCP认证全面升级公开课
- Cache problems after app release
- Junit单元测试框架详解
- Lumiprobe cell imaging study PKH26 cell membrane labeling kit
- Learning notes - steps of JDBC connection database operation
猜你喜欢

赋能「新型中国企业」,SAP Process Automation 落地中国

Huawei game failed to initialize init with error code 907135000

数商云:从规划到落地,五矿集团如何快速构建数字化发展新格局?

Supervarimag superconducting magnet system SVM series

Altair HyperWorks 2022 software installation package and installation tutorial

微服务大行其道的今天,Service Mesh是怎样一种存在?

宝,运维100+服务器很头疼怎么办?用行云管家!

混沌工程平台 ChaosBlade-Box 新版重磅发布

Once the SQL is optimized, the database query speed is increased by 60 times

【直播预约】数据库OBCP认证全面升级公开课
随机推荐
Dom4J解析XML、Xpath检索XML
Improve yolov5 with gsconv+slim neck to maximize performance!
Lumiprobe free radical analysis h2dcfda instructions
Lumiprobe 亚磷酰胺丨六甘醇亚磷酰胺说明书
Redis 实现限流的三种方式
Appgallery connect scenario development practice - image storage and sharing
Transform + ASM data
English语法_形容词/副词3级 -注意事项
Lake Shore 连续流动低温恒温器传输线
Learning notes - steps of JDBC connection database operation
见证时代!“人玑协同 未来已来”2022弘玑生态伙伴大会开启直播预约
MySQL常用图形管理工具 | 黑马程序员
More information about M91 fast hall measuring instrument
实现一个Prometheus exporter
宝,运维100+服务器很头疼怎么办?用行云管家!
Dlib+Opencv库实现疲劳检测
一次SQL优化,数据库查询速度提升 60 倍
洞态在某互联⽹⾦融科技企业的最佳落地实践
transform + asm资料
中英说明书丨人可溶性晚期糖基化终末产物受体(sRAGE)Elisa试剂盒