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/mysql56/bin/mysqladmin -u root password
'new-password'
/usr/local/mysql56/bin/mysqladmin -u root -h 472322.ea.com
password 'new-password'
Alternatively you can run:
/usr/local/mysql56/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/mysql56/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug
script!
The latest information about MySQL is available on the web
at
http://www.mysql.com
Support MySQL by buying support/licenses at
http://shop.mysql.com
New default config file was created as
/usr/local/mysql56/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the
system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use
the
--defaults-file argument to mysqld_safe when starting the
server
[root@472322 mysql56]#
10 copy start command
cp support-files/mysql.server /etc/init.d/mysqld5612
chmod 700 /etc/init.d/mysqld5612
echo "export
PATH=$PATH:/usr/local/mysql/bin">>/etc/profile
source /etc/profile
11 添加开机启动
chkconfig --add mysqld5612
12 start service
service mysqld5612 start
[root@squid-2 mysql]# service mysqld5612 start
Starting MySQL.......The server quit without updating PID
f[失败]usr/local/mysql/mysqld.pid).
[root@squid-2 mysql]#
查看日志报错如下:
2014-06-24 14:56:54 31726 [Note] Server socket created on IP:
'::'.
2014-06-24 14:56:54 31726 [ERROR] Can't start server : Bind on
unix socket: Permission denied
2014-06-24 14:56:54 31726 [ERROR] Do you already have another
mysqld server running on socket: /usr/local/mysql/mysql.sock
?
2014-06-24 14:56:54 31726 [ERROR] Aborting
解决原因是:
/usr/local/mysql跟目录需要赋予mysql权限
根据日志文件显示,首先检查运行权限,再看一下/usr/local/mysql/mysql.sock,发现/usr/local/mysql目录下并没有该文件,是否是没有权限写目录?
看到/usr/local/mysql目录是root用户,所以赋予mysql操作权限。
chown -R mysql.mysql /usr/local/mysql
[root@472322 data56]# service mysqld5612 start
Starting MySQL. SUCCESS!
[root@472322 data56]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.13 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 |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql>