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

Ubuntu安装mysql 及开启远程连接

2015-01-20 10:21 686 查看
本文安装环境Ubuntu13.04 X64,之前没有安装过mysql,使用的mysql版本是mysql-apt-config_0.3.2-1ubuntu12.04_all.deb

1.下载mysql-apt-config_0.3.2-1ubuntu12.04_all.deb 安装包,下载地址: http://dev.mysql.com/downloads/repo/apt/ 可以自己选择安装版本

2.执行命令:

sudo dpkg -i mysql-apt-config_0.3.2-1ubuntu12.04_all.deb


3. 安装过程中,需要选择安装的组件 (Mysql Server 或MySql Workbench)等,我采用默认设置,之间选择Apply

4.执行如下命令,获取最新安装包信息

sudo apt-get update


5.安装

sudo apt-get install mysql-server

[/code]

注意:记住自己输入的Root密码,也可以不输入,安装后再设定

6.运行停止服务

1)查看mysql运行状态

sudo service mysql status


2)启动mysql

sudo service mysql start


3)停止mysql

sudo service mysql stop


7.开启远程管理

1)设置远程用户及权限

mysql -uroot -p

mysql> grant all PRIVILEGES on *.* to admin@'%' identified by '123456';

Query OK, 0 rows affected (0.04 sec)

mysql> use information_schema

mysql> select * from user_privileges;

2)更改配置文件

打开 /etc/mysql/my.cnf 文件,找到 bind-address = 127.0.0.1 修改为 bind-address = 0.0.0.0 或 注释掉

重启mysql 。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: