您的位置:首页 > 数据库 > MySQL

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

2014-10-11 23:20 591 查看
现在的软件越来越好安装,尤其是在ubuntu下安装软件,更是没有技巧,只需要在联网的情况下使用apt-get inatll 即可。在决定安装mysql之前,要先确定系统是否已经安装mysql。

hadoop@master:~$ netstat -tap | grep mysql
(并非所有进程都能被检测到,所有非本用户的进程信息将不会显示,如果想看到所有信息,则必须切换到 root 用户)


由此可以看出系统中并没有安装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) ...


hadoop@master:~$ sudo apt-get install mysql-client

安装完成,再次登录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


到此安装和配置完成。

本文出自 “Forever Love” 博客,转载请务必保留此出处/article/6551017.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: