安装步骤如下:
tar zxvf mysql-5.5.14.tar.gz
# cd mysql-5.5.14
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql \
-DMYSQL_DATADIR=/data/mysql/data \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DMYSQL_TCP_PORT=3306
# make
# make install
##安装配置MySQL
# userdel -r mysql
# groupadd -g 3306 mysql
# useradd -u 3306 -g mysql -M -s /sbin/nologin mysql
# mkdir -p /data/mysql/data
# mkdir -p /data/mysql/log
# chown -R mysql:mysql /data/mysql
# chmod -R 755 /data/mysql
# cp support-files/my-medium.cnf /etc/my.cnf
# /usr/local/webserver/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql --datadir=/data/mysql/data & //初始化数据库
cp support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# /sbin/chkconfig --add mysqld
# /sbin/chkconfig mysqld on
# netstat -tnlp |grep 3306
# cd /usr/local/bin //进入用户的默认搜索路径下建立mysql命令的软连接,可以直接执行mysql命令
# ln -s /usr/local/webserver/mysql/bin/mysql mysql
# ln -s /usr/local/webserver/mysql/bin/mysqldump mysqldump
# ln -s /usr/local/webserver/mysql/bin/mysqladmin mysqladmin
1启动mysqld_safe &
# -bash: mysqld_safe: command not found
2 /usr/local/webserver/mysql/bin/mysqld_safe &
Warning: World-writable config file '/usr/local/webserver/mysql/my.cnf' is ignored
140512 10:58:08 mysqld_safe Logging to '/var/log/mysqld.log'.
140512 10:58:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost bin]# 140512 10:58:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
tail -n 200 /var/log/mysqld.log
140512 10:58:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Warning: World-writable config file '/usr/local/webserver/mysql/my.cnf' is ignored
2014-05-12 10:58:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-12 10:58:10 27779 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/webserver/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
2014-05-12 10:58:10 27779 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2014-05-12 10:58:10 27779 [Note] InnoDB: The InnoDB memory heap is disabled
2014-05-12 10:58:10 27779 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-05-12 10:58:10 27779 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-05-12 10:58:10 27779 [Note] InnoDB: Not using CPU crc32 instructions
2014-05-12 10:58:10 27779 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-05-12 10:58:10 27779 [Note] InnoDB: Completed initialization of buffer pool
2014-05-12 10:58:10 27779 [Note] InnoDB: Highest supported file format is Barracuda.
2014-05-12 10:58:10 27779 [Note] InnoDB: Log scan progressed past the checkpoint lsn 49463
2014-05-12 10:58:10 27779 [Note] InnoDB: Database was not shutdown normally!
2014-05-12 10:58:10 27779 [Note] InnoDB: Starting crash recovery.
2014-05-12 10:58:10 27779 [Note] InnoDB: Reading tablespace information from the .ibd files...
2014-05-12 10:58:10 27779 [Note] InnoDB: Restoring possible half-written data pages
2014-05-12 10:58:10 27779 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1600697
2014-05-12 10:58:11 27779 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
2014-05-12 10:58:12 27779 [Note] InnoDB: 128 rollback segment(s) are active.
2014-05-12 10:58:12 27779 [Note] InnoDB: Waiting for purge to start
2014-05-12 10:58:12 27779 [Note] InnoDB: 5.6.14 started; log sequence number 1600697
2014-05-12 10:58:12 27779 [Note] Server hostname (bind-address): '*'; port: 3306
2014-05-12 10:58:12 27779 [Note] IPv6 is available.
2014-05-12 10:58:12 27779 [Note] - '::' resolves to '::';
2014-05-12 10:58:12 27779 [Note] Server socket created on IP: '::'.
2014-05-12 10:58:12 27779 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
140512 10:58:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
cd /data/mysql/data/
ls -la
-rw-rw----. 1 mysql mysql 10684 May 9 17:11 user.frm
-rw-rw----. 1 mysql mysql 344 May 9 17:11 user.MYD
-rw-rw----. 1 mysql mysql 2048 May 9 17:11 user.MYI
-rw-rw----. 1 mysql mysql 8586 May 9 17:11 plugin.frm
-rw-rw----. 1 mysql mysql 0 May 9 17:11 plugin.MYD
-rw-rw----. 1 mysql mysql 1024 May 9 17:11 plugin.MYI
...
....
check my.cnf
datadir =设置为当前db迁移过的路径
socket==设置为当前db迁移过的路径 /data/mysql/data/
因为:my.cnf 默认配置为初始安装没有修改
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
所以找不到
然后再启动 正常
阅读(758) | 评论(0) | 转发(0) |