6. 初始化DB
[root@ycdatadbsupport mysql5]# scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
Installing MySQL system tables...
140612 13:51:56 [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...
140612 13:51:56 [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:
Alternatively you can run:
/usr/local/mysql5//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/mysql5/ ; /usr/local/mysql5//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql5//mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
7. 启动数据库
[root@ycdatadbsupport local]# mysqld_safe --defaults-file=/etc/my.cnf &
[1] 7666
[root@ycdatadbsupport local]# 140612 14:46:33 mysqld_safe Logging to ‘/data/mysql/mysql_3306/data/error.log‘.
140612 14:46:33 mysqld_safe Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
8. 连接MSYQL, 修改ROOT密码。第一次登录是不需要密码的。 这样MYSQL就安装成功了。
[root@ycdatadbsupport local]# mysql -uroot -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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.
(testing)root@ycdatadbsupport [(none)]> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "vipshop";
Query OK, 0 rows affected (0.00 sec)
(testing)root@ycdatadbsupport [(none)]> use mysql;
Database changed
(testing)root@ycdatadbsupport [mysql]> update user set password = password(‘vipshop‘) where user=‘root‘;
Query OK, 4 rows affected (0.01 sec)
Rows matched: 5 Changed: 4 Warnings: 0
(testing)root@ycdatadbsupport [mysql]> exit
Bye
[root@ycdatadbsupport local]# mysql -uroot -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.37-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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.