ubuntu 11.10安装mysql
2012-04-01 12:03
316 查看
1. 安装
2. 服务器配置
1)编辑配置文件
将 'bind-address = 127.0.0.1' 替换为:
bind-address = 0.0.0.0
2)防火墙,别忘了防火墙!
3)本机连接,配置用户和用户数据库
3.客户端
1)安装mysql-client
gt@gt-Dell:~$ sudo apt-get install mysql-client
连接,创建用户表,插入测试数据
gt@gt-Dell:~$ mysql -h devserver -u dev -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.1.58-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> USE devcom
\Database changed
mysql> CREATE TABLE devuser (dev_id int, dev_name char(20));
mysql> INSERT INTO devuser (dev_id,dev_name) VALUES(1001,'Pan Black');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM DEVUSER;
ERROR 1146 (42S02): Table 'devcom.DEVUSER' doesn't exist
mysql> SELECT * FROM devuser;
+--------+-----------+
| dev_id | dev_name |
+--------+-----------+
| 1001 | Pan Black |
+--------+-----------+
1 row in set (0.00 sec)
mysql>
devadm@devserver:~$ sudo apt-get install mysql-server ...... The following NEW packages will be installed: libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16 libnet-daemon-perl libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server mysql-server-5.1 mysql-server-core-5.1 0 upgraded, 12 newly installed, 0 to remove and 1 not upgraded. Need to get 23.8 MB of archives. After this operation, 61.2 MB of additional disk space will be used. Do you want to continue [Y/n]? ...... 【mysql root 密码设为:mygreatsecret】 ...... |
1)编辑配置文件
devadm@devserver:~$ sudo vim /etc/mysql/my.cnf |
bind-address = 0.0.0.0
2)防火墙,别忘了防火墙!
devadm@devserver:~$ sudo ufw allow mysql Rule added Rule added (v6) devadm@devserver:~$ devadm@devserver:~$ sudo ufw status Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere 139/tcp ALLOW Anywhere 445/tcp ALLOW Anywhere 8080/tcp ALLOW Anywhere 3306 ALLOW Anywhere 22/tcp ALLOW Anywhere (v6) 139/tcp ALLOW Anywhere (v6) 445/tcp ALLOW Anywhere (v6) 8080/tcp ALLOW Anywhere (v6) 3306 ALLOW Anywhere (v6) devadm@devserver:~$ |
devadm@devserver:~$ mysql -h 127.0.0.1 -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 43 Server version: 5.1.58-1ubuntu1 (Ubuntu) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE DATABASE devcom; mysql> CREATE USER dev; mysql> GRANT ALL PRIVILEGES ON devcom.* TO 'dev'@'%' ; mysql> SET PASSWORD FOR 'dev'@'%' = PASSWORD('mylittlesecret'); mysql> mysql> quit; Bye devadm@devserver:~$ |
1)安装mysql-client
gt@gt-Dell:~$ sudo apt-get install mysql-client
连接,创建用户表,插入测试数据
gt@gt-Dell:~$ mysql -h devserver -u dev -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.1.58-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> USE devcom
\Database changed
mysql> CREATE TABLE devuser (dev_id int, dev_name char(20));
mysql> INSERT INTO devuser (dev_id,dev_name) VALUES(1001,'Pan Black');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM DEVUSER;
ERROR 1146 (42S02): Table 'devcom.DEVUSER' doesn't exist
mysql> SELECT * FROM devuser;
+--------+-----------+
| dev_id | dev_name |
+--------+-----------+
| 1001 | Pan Black |
+--------+-----------+
1 row in set (0.00 sec)
mysql>
相关文章推荐
- 总结 ubuntu 11.10 安装配置 JDK7 +TOMCAT7+MYECLIPSE9.1+MYSQL 5.1
- MySQL安装指南(Ubuntu 11.10)-简化版
- Ubuntu11.10 下安装mysql 与配置
- [转]Ubuntu 11.10编译安装nginx、PHP 5.3.8、mysql
- ubuntu 11.10下面安装apache+php+mysql+phpadmin搭建web环境
- ubuntu 11.10下面安装apache+php+mysql+phpadmin搭建web环境
- ubuntu 11.10 server 安装mysql-5.5.22-linux2.6-i686.tar.gz
- Ubuntu Server 11.10 安装 MySQL,简单配置,及图形化工具
- Ubuntu 11.10 安装nginx+php5+mysql 的web服务器
- Ubuntu Server 11.10 安装 MySQL,简单配置,及图形化工具
- Ubuntu Server 11.10 安装 MySQL,简单配置,及图形化工具
- ubuntu 11.10 安装mysql
- 阿里云主机ubuntu安装Mysql并远程连接的配置过程
- 在Ubuntu上源码安装MySQL+安装问题解决+安全优化
- Ubuntu 安装mysql和简单操作
- ubuntu 安装mysql 错误Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-lmPxC
- Centos6编译安装Mysql5.7.18, rpm 安装mysql5.7.18,ubuntu apt安装mysql
- ubuntu安装最新版本mysql
- Ubuntu安装Python的mysqlclient
- ubuntu快速安装lamp及mysql管理phpmyadmin