Ubuntu 14.04下MySQL服务器和客户端的安装
下面进行简单的配置
安装完成后通过修改/etc/mysql/my.cnf(此文件为mysql的配置文件)。将文件中的binding-address=127.0.0.1注释掉。其它配置根据需要更改。
Hadoop@master:~$ sudo vi /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
登录数据库:
hadoop@master:~$ msyql -u root -p
未找到 'msyql' 命令,您要输入的是否是:
命令 'mysql' 来自于包 'percona-xtradb-cluster-client-5.5' (universe)
命令 'mysql' 来自于包 'mysql-client-core-5.5' (main)
命令 'mysql' 来自于包 'mariadb-client-core-5.5' (universe)
命令 'mysql' 来自于包 'mysql-client-core-5.6' (universe)
msyql:未找到命令
按 Ctrl+C
出现改错误原因是没有安装MySQL客户端,执行命令安装MySQL对应的客户端:
hadoop@master:~$ sudo apt-get install mysql-client
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:
mysql-client
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 158 个软件包未被升级。
需要下载 12.3 kB 的软件包。
解压缩后会消耗掉 129 kB 的额外空间。
获取:1 http://us.archive.Ubuntu.com/ubuntu/ trusty-updates/main mysql-client all 5.5.38-0ubuntu0.14.04.1 [12.3 kB]
下载 12.3 kB,耗时 1秒 (10.2 kB/s)
Selecting previously unselected package mysql-client.
(正在读取数据库 ... 系统当前共安装有 212633 个文件和目录。)
Preparing to unpack .../mysql-client_5.5.38-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-client (5.5.38-0ubuntu0.14.04.1) ...
正在设置 mysql-client (5.5.38-0ubuntu0.14.04.1) ...
安装完成,再次登录MySQL:
hadoop@master:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.5.38-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
执行以下命令,配置mysql远程访问:
mysql> grant all privileges on *.* to root@'%' identified by "root";
Query OK, 0 rows affected (0.01 sec)
重启msyql服务即可远程访问
hadoop@master:~$ sudo service mysql restart
mysql stop/waiting
mysql start/running, process 32359
到此安装和配置完成。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!