Install MySQL(5.6.29) using RPM

lovehewenyu發表於2016-04-09


1.check mysql is whether installed
rpm -qa | grep -i mysql

2.forced remove mysql old rpm
rpm -e mysql --nodeps

3.create mysql data directory
mkdir -p /mysql/data/3307/

4.forced remove mysql old config
rm /var/lib/mysql/*
rm /tmp/*
rm /etc/my.cnf

5.install mysql-server for rpm

[root@dbdou01 mysql]# rpm -ivh MySQL-server-5.6.29-1.el6.x86_64.rpm
warning: MySQL-server-5.6.29-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
2016-06-22 14:47:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-22 14:47:15 0 [Note] /usr/sbin/mysqld (mysqld 5.6.29) starting as process 14438 ...
2016-06-22 14:47:15 14438 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-06-22 14:47:15 14438 [Note] InnoDB: The InnoDB memory heap is disabled
2016-06-22 14:47:15 14438 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-06-22 14:47:15 14438 [Note] InnoDB: Memory barrier is not used
2016-06-22 14:47:15 14438 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-06-22 14:47:15 14438 [Note] InnoDB: Using Linux native AIO
2016-06-22 14:47:15 14438 [Note] InnoDB: Using CPU crc32 instructions
2016-06-22 14:47:15 14438 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-06-22 14:47:15 14438 [Note] InnoDB: Completed initialization of buffer pool
2016-06-22 14:47:15 14438 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-06-22 14:47:15 14438 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-06-22 14:47:15 14438 [Note] InnoDB: Database physically writes the file full: wait...
2016-06-22 14:47:15 14438 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-06-22 14:47:16 14438 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-06-22 14:47:16 14438 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-06-22 14:47:16 14438 [Warning] InnoDB: New log files created, LSN=45781
2016-06-22 14:47:16 14438 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-06-22 14:47:16 14438 [Note] InnoDB: Doublewrite buffer created
2016-06-22 14:47:16 14438 [Note] InnoDB: 128 rollback segment(s) are active.
2016-06-22 14:47:16 14438 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-06-22 14:47:16 14438 [Note] InnoDB: Foreign key constraint system tables created
2016-06-22 14:47:16 14438 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-06-22 14:47:16 14438 [Note] InnoDB: Tablespace and datafile system tables created.
2016-06-22 14:47:16 14438 [Note] InnoDB: Waiting for purge to start
2016-06-22 14:47:16 14438 [Note] InnoDB: 5.6.29 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2016-06-22 14:47:17 14438 [Note] Binlog end
2016-06-22 14:47:17 14438 [Note] InnoDB: FTS optimize thread exiting.
2016-06-22 14:47:17 14438 [Note] InnoDB: Starting shutdown...
2016-06-22 14:47:18 14438 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2016-06-22 14:47:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-22 14:47:18 0 [Note] /usr/sbin/mysqld (mysqld 5.6.29) starting as process 14461 ...
2016-06-22 14:47:18 14461 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-06-22 14:47:18 14461 [Note] InnoDB: The InnoDB memory heap is disabled
2016-06-22 14:47:18 14461 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-06-22 14:47:18 14461 [Note] InnoDB: Memory barrier is not used
2016-06-22 14:47:18 14461 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-06-22 14:47:18 14461 [Note] InnoDB: Using Linux native AIO
2016-06-22 14:47:18 14461 [Note] InnoDB: Using CPU crc32 instructions
2016-06-22 14:47:18 14461 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-06-22 14:47:18 14461 [Note] InnoDB: Completed initialization of buffer pool
2016-06-22 14:47:18 14461 [Note] InnoDB: Highest supported file format is Barracuda.
2016-06-22 14:47:18 14461 [Note] InnoDB: 128 rollback segment(s) are active.
2016-06-22 14:47:18 14461 [Note] InnoDB: Waiting for purge to start
2016-06-22 14:47:18 14461 [Note] InnoDB: 5.6.29 started; log sequence number 1625977
2016-06-22 14:47:19 14461 [Note] Binlog end
2016-06-22 14:47:19 14461 [Note] InnoDB: FTS optimize thread exiting.
2016-06-22 14:47:19 14461 [Note] InnoDB: Starting shutdown...
2016-06-22 14:47:20 14461 [Note] InnoDB: Shutdown completed; log sequence number 1625987

 


A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.   <==default password

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation   <==reset password and others attribute

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at

The latest information about MySQL is available on the web at

 

Support MySQL by buying support/licenses at

WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /usr/my-new.cnf,
please compare it with your file and take the changes you need.

[root@dbdou01 mysql]# rpm -ivh MySQL-client-5.6.29-1.el6.x86_64.rpm
warning: MySQL-client-5.6.29-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
[root@dbdou01 mysql]# rpm -ivh MySQL-shared-5.6.29-1.el6.x86_64.rpm
warning: MySQL-shared-5.6.29-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-shared           ########################################### [100%]
[root@dbdou01 mysql]# rpm -ivh MySQL-test-5.6.29-1.el6.x86_64.rpm  
warning: MySQL-test-5.6.29-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-test             ########################################### [100%]

6.check mysql server is whether enable
ps -ef | grep -i mysql

7.enable mysql server
service mysql start

8.find password and login mysql set new password
[root@dbdou01 mysql]#  cat /root/.mysql_secret
# The random password set for the root user at Wed Jun 22 14:47:17 2016 (local time): v0VNwRRRtgCK0pT6

[root@dbdou01 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.29

Copyright (c) 2000, 2016, 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;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement  <==need reset password

[root@dbdou01 mysql]# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n 
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

 


All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

9.login mysql and show databases
[root@dbdou01 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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.01 sec)

 
########################################################################################
版權所有,文章允許轉載,但必須以連結方式註明源地址,否則追究法律責任!【QQ交流群:53993419】
QQ:14040928 E-mail:
本文連結: http://blog.itpub.net/26442936/viewspace-2077956/ 
########################################################################################


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26442936/viewspace-2077956/,如需轉載,請註明出處,否則將追究法律責任。

相關文章