1、重新初始化建库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[root@etiantian data]# mkdir mysql
[root@etiantian data]# chown -R mysql.mysql mysql
[root@etiantian data]# /install/mysql/scripts/mysql_install_db--basedir=/install/mysql/ --datadir=/data/mysql/ --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
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:
/install/mysql//bin/mysqladmin -u root password 'new-password'
/install/mysql//bin/mysqladmin -u root -h etiantian.cn password'new-password'
Alternatively you can run:
/install/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 /install/mysql/ ; /install/mysql//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /install/mysql//mysql-test ; perl mysql-test-run.pl
Please report any problems with the /install/mysql//scripts/mysqlbugscript
 
 
 
 
 
[root@etiantian data]# /etc/init.d/mysqld start
Starting MySQL.......................... SUCCESS!
[root@etiantian data]# mysql
mysql:Collation'utf8-general_ci' is not a compiled collation and is not specifiedin the '/install/mysql/share/charsets/Index.xml' file
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.33-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rightsreserved.
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 inputstatement.
mysql> quit
-> Ctrl-C -- exit!
Aborted

 

 

 

 

[root@etiantian data]# cat /root/.mysql_history |grep create

create\040database\040eshop_ett100\040DEFAULT\040CHARACTER\040SET\040utf8\040COLLATE\040utf8_general_ci;确定建库的命令。
[root@etiantian data]# mysql
mysql: Collation 'utf8-general_ci' is not a compiled collation andis not specified in the '/install/mysql/share/charsets/Index.xml' file
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.33-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rightsreserved.
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 inputstatement.
mysql> create database eshop_ett100 CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
mysql> quit
Bye

 

 

 

 

 

[root@etiantian data]# mysql eshop_ett100 </home/xxx/eshop_ett100.0624.sql
mysql: Collation 'utf8-general_ci' is not acompiled collation and is not specified in the'/install/mysql/share/charsets/Index.xml' file
ERROR 1030 (HY000) at line 46: Got error -1from storage engine

 

 

 

 

 

[root@etiantian data]# pwd
/data
[root@etiantian data]# rm -fr mysql
[root@etiantian data]# mkdir mysql
[root@etiantian data]# chown -R mysql.mysql <==这是着急的杰作,连目标都没加,偶也紧张啊。
chown: missing operand after `mysql.mysql'
Try `chown --help' for more information.
[root@etiantian data]# chown -R mysql.mysql mysql
 
[root@etiantian data]# /install/mysql/scripts/mysql_install_db--basedir=/install/mysql/ --datadir=/data/mysql/ --user=mysql
 
Installing MySQL system tables...
OK
Filling help tables...
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:
/install/mysql//bin/mysqladmin -u root password 'new-password'
/install/mysql//bin/mysqladmin -u root -h etiantian.cn password'new-password'
Alternatively you can run:
/install/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 /install/mysql/ ; /install/mysql//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /install/mysql//mysql-test ; perl mysql-test-run.pl
Please report any problems with the /install/mysql//scripts/mysqlbugscript
 
 
[root@etiantian data]# /etc/init.d/mysqld start
Starting MySQL......................... SUCCESS!
[root@etiantian data]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.33-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rightsreserved.
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 inputstatement.
 
 
[root@etiantian data]# mysql eshop_ett100 </home/xxx/eshop_ett100.0624.sql
ERROR 1030 (HY000) at line 46: Got error -1 from storage engine
[root@etiantian data]# /etc/init.d/mysqld stop
Shutting down MySQL. SUCCESS!
[root@etiantian data]# vi /etc/my.cnf <==此处顺便调整相关其他参数
innodb_force_recovery= 0 调整这个参数为0
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 614
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
query_cache_limit = 1M
query_cache_min_res_unit = 2k
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
........
"/etc/my.cnf" 159L, 4948C written 
 
 
[root@etiantian data]# /etc/init.d/mysqld start
Starting MySQL.
. SUCCESS!
[root@etiantian data]#
[root@etiantian data]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.33-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rightsreserved.
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 inputstatement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| eshop_ett100 |
| test |
+--------------------+
5 rows in set (0.00 sec)