当前位置:网站首页>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;
远程客户端连接

边栏推荐
- Manufacturing SRM management system supplier all-round closed-loop management, to achieve procurement sourcing and process efficient collaboration
- How to realize the applet in its own app to realize continuous live broadcast
- Huawei cloud experts explain the new features of gaussdb (for MySQL)
- Three ways for redis to realize current limiting
- 苹果产品在日本全面涨价,iPhone13涨19%
- PMP是被取消了吗??
- 一次SQL优化,数据库查询速度提升 60 倍
- 水产行业智能供应链管理平台解决方案:支撑企业供应链数字化,提升企业管理效益
- Solution of intelligent supply chain management platform in aquatic industry: support the digitalization of enterprise supply chain and improve enterprise management efficiency
- 寶,運維100+服務器很頭疼怎麼辦?用行雲管家!
猜你喜欢

Solidity - 算术运算的截断模式(unchecked)与检查模式(checked)- 0.8.0新特性
![[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched](/img/5c/b0030fd5fbc07eb94013f2699c2a04.png)
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched

Lake shore M91 fast hall measuring instrument

Digital business cloud: from planning to implementation, how does Minmetals Group quickly build a new pattern of digital development?

Games202 operation 0 - environment building process & solving problems encountered

Viewing the whole ecology of Tiktok from a macro perspective

ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing

前4A高管搞代运营,拿下一个IPO

苹果产品在日本全面涨价,iPhone13涨19%

Cdga | if you are engaged in the communication industry, you should get a data management certificate
随机推荐
从零开始学 MySQL —数据库和数据表操作
MySQL常用图形管理工具 | 黑马程序员
Appgallery connect scenario development practice - image storage and sharing
June issue | antdb database participated in the preparation of the "Database Development Research Report" and appeared on the list of information technology and entrepreneurship industries
PostgreSQL varchar[] 数组类型操作
[pytorch record] distributed training dataparallel and distributeddataparallel of the model
智慧防疫系统为建筑工地复工复产提供安全保障
市值蒸发740亿,这位大佬转身杀入预制菜
[live broadcast appointment] database obcp certification comprehensive upgrade open class
Taiaisu M source code construction, peak store app premium consignment source code sharing
SuperVariMag 超导磁体系统 — SVM 系列
Improve yolov5 with gsconv+slim neck to maximize performance!
[pytorch record] automatic hybrid accuracy training torch cuda. amp
制造业SRM管理系统供应商全方位闭环管理,实现采购寻源与流程高效协同
B2B e-commerce platform solution for fresh food industry to improve the standardization and transparency of enterprise transaction process
Graduation summary
Solidity - 算术运算的截断模式(unchecked)与检查模式(checked)- 0.8.0新特性
【pytorch记录】模型的分布式训练DataParallel、DistributedDataParallel
线程的并行、并发、生命周期
Chaos engineering platform chaosblade box new heavy release