mysql单机多实例运行实践(1)
1.install mysql
get mysql
http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.1/mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# tar -zxvf mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# cd mysql-5.1.41-linux-i686-icc-glibc23
[root@localhost mysql]# vim README
[root@localhost mysql]# cd ..
[root@localhost mysql]# cp mysql-5.1.41-linux-i686-icc-glibc23 /usr/local/mysql
[root@localhost mysql]# cd /usr/local/mysql/
[root@localhost mysql]# vim INSTALL-BINARY
######################
The basic commands that you must execute to install and use a
MySQL binary distribution are:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
######################
[root@localhost mysql]# netstat -na | grep "3306"
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
[root@localhost mysql]# /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.41 MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test 
相关文档:
mysql索引详解,摘自《MySQL 5权威指南》
本文介绍了数据库索引,及其优、缺点。针对MySQL索引的特点、应用进行了详细的描述。分析了如何避免MySQL无法使用,如何使用EXPLAIN分析查询语句,如何优化MySQL索引的应用。本文摘自《MySQL 5权威指南》(3rd)的8.9节。(2007.07.0 ......
在XAMPP里MYSQL以服务方式启动失败,提示错误是 1067 进程意外终止
解决方法:
1、 进入 xampp安装目录
2、进入mysql\bin\目录, 打开my.ini , 修改
[mysqld]
port= 3306
socket= "/xampp/mysql/mysql.sock"
basedir="/xampp/mysql"
tmpdir="/xampp/tmp"
datadir="/xampp/mysql/data"
把路径补全,比如x ......
MySQL的基本命令
[ ]中的内容为可选项
--创建数据库
mysql> create database 数据库名称
--创建表
mysql> create table 表名 (
列的名字(id)类型(int(4))primary key(定义主键) auto_increment(描述 自增),
……,
);
--查看所有数据库
mys ......
Installing the MySQL Driver
先查看所缺失的相关包:
$ apt-cache search libmysqlclient
libcrypt-mysql-perl - Perl module to emulate the MySQL PASSWORD() function.
libglpk0 - linear programming kit with integer (MIP) support
libmysqlclient16 - MySQL database client library
libmysqlclient16-dev - ......
最近在MySQL上做了点工作,发现很多人都在询问MySQL嵌套查询的问题,许多人都觉得MySQL不支持嵌套查询,其实MySQl从4.11版后已经完全支持嵌套查询了,那么下面我举些简单的嵌套查询的例子吧(源程序来自MySQL User Manual):
1. SELECT语句的子查询:
语法: SELECT ... from (subquery) AS name ...
先创建一个表:
......