--添加用户和组 [root@zlm local]# groupadd
[root@zlm local]# useradd -g mysql -s /sbin/nologin -d /opt/msyql mysql
--创建目录 [root@zlm local]# mkdir /data/mysql/mysql_3306/{data,logs,tmp} -p
--做软链接到/usr/local/mysql [root@zlm local]# ln -s /opt/mysql/mysql-5.5.39-linux2.6-i686/ mysql [root@zlm local]# ll -l mysql lrwxrwxrwx 1 root root 38 Sep 24 00:12 mysql -> /opt/mysql/mysql-5.5.39-linux2.6-i686/
--赋权限 [root@zlm local]# chown -R mysql:mysql /data/mysql/ [root@zlm local]# chown -R mysql:mysql /usr/local/mysql/
--添加环境变量 [root@zlm local]# echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile [root@zlm local]# cd mysql
--初始化数据库 [root@zlm mysql]# ./scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf Installing MySQL system tables... 140924 0:12:43 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set OK Filling help tables... 140924 0:12:44 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set 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 zlm 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 at http://bugs.mysq?l.com/
--复制mysql.server文件到/etc/init.d/下并改名为mysql [root@zlm mysql]# cp support-files/mysql.server /etc/init.d/mysql cp: overwrite `/etc/init.d/mysql'? yes
--启动MySQL [root@zlm mysql]# service mysql start Starting MySQL...............The server quit without updating PID file (/data/mysql/mysql_3306/data/zlm.pid). [FAILED]
--查看错误日志error.log(如未在/etc/my.cnf中定义,默认格式为hostname.err) [root@zlm local]# cd /data/mysql/mysql_3306/data/
[root@zlm data]# ll total 403024 -rw-rw---- 1 mysql mysql 2824 Sep 24 00:13 error.log -rw-rw---- 1 mysql mysql 104857600 Sep 24 00:13 ibdata1 -rw-rw---- 1 mysql mysql 104857600 Sep 24 00:13 ib_logfile0 -rw-rw---- 1 mysql mysql 104857600 Sep 24 00:13 ib_logfile1 -rw-rw---- 1 mysql mysql 97685504 Sep 24 00:13 ib_logfile2 drwx------ 2 mysql root 4096 Sep 24 00:12 mysql drwx------ 2 mysql mysql 4096 Sep 24 00:12 performance_schema drwx------ 2 mysql root 4096 Sep 24 00:12 test [root@zlm data]# cat error.log 140924 00:13:33 mysqld_safe Starting mysqld daemon with databases from /data/mysql/mysql_3306/data 140924 0:13:33 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set 140924 0:13:33 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a |