手机版
你好,游客 登录 注册
背景:
阅读新闻

Ubuntu 14.04下MySQL服务器和客户端的安装

[日期:2014-10-12] 来源:Linux社区  作者:dwf07223 [字体:大 中 小]

下面进行简单的配置

安装完成后通过修改/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

到此安装和配置完成。

更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-10/107912.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款