This version of MySQL Cluster is no longer maintained.
Please use the separate sources provided for MySQL Cluster instead.
See http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster.html
for more details.
Thank you for choosing MySQL!
Remember to check the platform specific part of the reference manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.
[root@node6 mysql-5.1.73]# /usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql
Installing MySQL system tables...
140104 16:18:43 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
140104 16:18:43 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
140104 16:18:43 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
140104 16:18:43 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql//bin/mysqladmin -u root password 'new-password'
/usr/local/mysql//bin/mysqladmin -u root -h node6.test.com password 'new-password'
Alternatively you can run:
/usr/local/mysql//bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql/ ; /usr/local/mysql//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql//scripts/mysqlbug script!
注,从上面的内容中我们看到了几个警告,我们查看一下。
140104 16:18:43 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
140104 16:18:43 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
140104 16:18:43 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
140104 16:18:43 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
[root@node6 data]# ls /data/mysql/
mysql mysql-bin.000001 mysql-bin.000002 mysql-bin.index test
9.启动一下mysql
[root@node6 ~]# service mysqld start
Starting MySQL.. SUCCESS!
10.测试访问一下
[root@node6 ~]# /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.73-log Source distribution
Copyright (c) 2000, 2013, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql>
[root@node6 mysql]# vim /etc/profile.d/mysql.sh
export PATH=$PATH:/usr/local/mysql/bin/
[root@node6 mysql]# source /etc/profile
[root@node6 mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, 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> show variables like "innodb_buffer_pool_size";
+-------------------------+---------+
| Variable_name | Value |
+-------------------------+---------+
| innodb_buffer_pool_size | 8388608 |
+-------------------------+---------+
1 row in set (0.00 sec)
下面我们修改一下并重启mysql,
[root@node6 ~]# vim /etc/my.cnf
innodb_buffer_pool_size = 384M
[root@node6 ~]# service mysqld restart
Shutting down MySQL..... SUCCESS!
Starting MySQL. SUCCESS!
mysql> show variables like "innodb_buffer_pool_size";
+-------------------------+-----------+
| Variable_name | Value |
+-------------------------+-----------+
| innodb_buffer_pool_size | 402653184 |
+-------------------------+-----------+
1 row in set (0.00 sec)
好了,问题解决下面我们继续测试。
mysql> insert into t2 select * from t2;
Query OK, 5242880 rows affected (52.81 sec)
Records: 5242880 Duplicates: 0 Warnings: 0
mysql> select count(*) from t2;
+----------+
| count(*) |
+----------+
| 10485760 |
+----------+
1 row in set (6.63 sec)
3.总结
(1).MyISAM 引擎
插入500多万行数据花费的时间为2.35秒。
用select count(*) from t1 命令查询的时间为 0.00 秒。
(2).InnoDB 引擎
插入500多万行数据花费的时间为 52.81 秒。
用select count(*) from t1 命令查询的时间为 6.63 秒。
六、 1000 万数据性能测试
1.t1表插入并查询数据
mysql> insert into t1 select * from t1;
Query OK, 10485760 rows affected (8.47 sec)
Records: 10485760 Duplicates: 0 Warnings: 0
mysql> select count(*) from t1;
+----------+
| count(*) |
+----------+
| 20971520 |
+----------+
1 row in set (0.07 sec)
2.t2表插入并查询数据
mysql> insert into t2 select * from t2;
Query OK, 10485760 rows affected (1 min 53.02 sec)
Records: 10485760 Duplicates: 0 Warnings: 0
mysql> select count(*) from t2;
+----------+
| count(*) |
+----------+
| 20971520 |
+----------+
1 row in set (18.50 sec)