http://dev.mysql.com/doc/refman/5.6/en/index.htmlmysql官网安装手册http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html源码安装说明
[root@mysql-a mysql]# vim /etc/my.cnf
[mysqld]
datadir=/data/
[root@web2_lnmp mysql]# /etc/init.d/mysql start
Starting MySQL... SUCCESS!
Mysql 启动报错总结:
[root@mysql-a mysql]# /etc/init.d/mysql restart
ERROR!MySQL server PID file could not be found!
Starting MySQL... ERROR! The server quitwithout updating PID file (/data/mysql-b.pid).
[root@web2_lnmp mysql]# ps -ef |grep mysql
root 47351 1 0 00:32 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe--datadir=/data
--pid-file=/data//web2_lnmp.pid
mysql 47527 47351 0 00:32 pts/1 00:00:01 /usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql --datadir=/data/--plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log--pid-file=/data//web2_lnmp.pid --socket=/var/lib/mysql/mysql.sock
root 47610 2817 0 00:48 pts/1 00:00:00 grep mysql
[root@mysql-a mysql]# kill 25588
[root@mysql-a mysql]# kill 25689
[root@mysql-a mysql]# ps -ef|grep mysql
root 26111 5590 0 08:05 pts/0 00:00:00 grep mysql
[root@mysql-a mysql]# /etc/init.d/mysql restart
Shutting down MySQL. SUCCESS!
Starting MySQL. SUCCESS! 启动ok
如果/etc/my.cnf 没有生成,拷贝模板过去参照官网进行修改
[root@mysql-b mysql]# cp support-files/my-default.cnf/etc/my.cnf
编译的时候我指定配置文件的路径了,但是没有生成,拷贝一个模板到/etc/
修改/etc/init.d/mysql 的启动脚本
如果启动报错:
[root@mysql-a mysql]# /etc/init.d/mysqlrestart
ERROR!MySQL server PID file could not be found!
Starting MySQL.. ERROR! The server quitwithout updating PID file (/var/lib/mysql/mysql-a.pid).
解决方法:
[root@mysql-a mysql]# cp support-files/my-default.cnf/etc/my.cnf
[root@mysql-a mysql]# /etc/init.d/mysql restart
ERROR! MySQLserver PID file could not be found!
Starting MySQL. SUCCESS!
然后去修改配置文件
默认的my.cnf
[root@mysql-a mysql]# cat support-files/my-default.cnf
# For advice on how to change settings please see
#
# *** DO NOT EDIT THIS FILE. It's a template which willbe copied to the
# *** default location during install, and will bereplaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for themost important data
# cache in MySQL. Start at 70% of total RAM for dedicatedserver, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important dataintegrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set asrequired.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful forreporting servers.
# The server defaults are faster for transactions andfast SELECTs.
# Adjust sizes as needed, experiment to find the optimalvalues.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[root@mysql-a mysql]# diff /etc/my.cnfsupport-files/my-default.cnf
2a3,5
> # *** DO NOT EDIT THIS FILE. It's a template whichwill be copied to the
> # *** default location during install, and will bereplaced if you
> # *** upgrade to a newer version of MySQL.
15,19c18,22
---
> # basedir = .....
> # datadir = .....
> # port = .....
> # server_id = .....
> # socket = .....
29,31d31
[root@mysql-a mysql]# mysql -uroot 登陆成功,mysql的安装完成
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23 Source distribution
Copyright (c) 2000, 2015, Oracle and/or its affiliates.All rights reserved.
Oracle is a registered trademark of Oracle Corporationand/or its
affiliates. Other names may be trademarks of theirrespective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear thecurrent input statement.
mysql>
mysql错误总结,主要是安装目录的权限和my.cnf 默认的配置文件需要修改。
本文出自 “小菜鸟” 博客,,请务必保留此出处