MySQL installation configuration
Install the dependency package and MySQL:
Yum–y Install Perl Libaio numactl
RPM-IVH mysql-shared-5.6.30-1.el6.x86_64.rpm
RPM-IVH mysql-shared-compat-5.6.30-1.el6.x86_64.rpm
RPM-IVH mysql-devel-5.6.30-1.el6.x86_64.rpm
RPM-IVH mysql-client-5.6.30-1.el6.x86_64.rpm (Requires/usr/bin/perl)
RPM-IVH mysql-server-5.6.30-1.el6.x86_64.rpm (Requires/usr/bin/perl, libaio.so.1, libnuma.so.1)
Preparing ... ########################################### [100%]
1:mysql-server ########################################### [100%]
Warning:user MySQL does not exist-using root
Warning:group MySQL does not exist-using root
2016-05-16 18:31:25 0 [Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-16 18:31:25 0 [Note]/usr/sbin/mysqld (mysqld 5.6.30) starting as Process 5934 ...
2016-05-16 18:31:25 5934 [Note] innodb:using Atomics to ref count buffer pool pages
2016-05-16 18:31:25 5934 [Note] innodb:the InnoDB memory heap is disabled
2016-05-16 18:31:25 5934 [Note] innodb:mutexes and rw_locks use GCC atomic builtins
2016-05-16 18:31:25 5934 [Note] innodb:memory barrier is not used
2016-05-16 18:31:25 5934 [Note] innodb:compressed tables use zlib 1.2.3
2016-05-16 18:31:25 5934 [Note] innodb:using Linux native AIO
2016-05-16 18:31:25 5934 [Note] innodb:using CPU CRC32 Instructions
2016-05-16 18:31:25 5934 [Note] innodb:initializing buffer pool, size = 128.0M
2016-05-16 18:31:25 5934 [Note] innodb:completed initialization of buffer pool
2016-05-16 18:31:25 5934 [Note] innodb:the first specified data file./ibdata1 did not exist:a new database to be create D!
2016-05-16 18:31:25 5934 [Note] innodb:setting file./ibdata1 size to MB
2016-05-16 18:31:25 5934 [Note] Innodb:database physically writes the file full:wait ...
2016-05-16 18:31:26 5934 [Note] innodb:setting log file./ib_logfile101 size to + MB
2016-05-16 18:31:26 5934 [Note] innodb:setting log file./ib_logfile1 size to + MB
2016-05-16 18:31:26 5934 [Note] innodb:renaming log file./ib_logfile101 to./ib_logfile0
2016-05-16 18:31:26 5934 [Warning] innodb:new log files created, lsn=45781
2016-05-16 18:31:26 5934 [Note] innodb:doublewrite buffer not found:creating new
2016-05-16 18:31:26 5934 [Note] Innodb:doublewrite buffer created
2016-05-16 18:31:26 5934 [Note] innodb:128 rollback segment (s) is active.
2016-05-16 18:31:26 5934 [Warning] innodb:creating FOREIGN KEY constraint system tables.
2016-05-16 18:31:26 5934 [Note] innodb:foreign key constraint system tables created
2016-05-16 18:31:26 5934 [Note] innodb:creating tablespace and datafile system tables.
2016-05-16 18:31:26 5934 [Note] innodb:tablespace and datafile system tables created.
2016-05-16 18:31:26 5934 [Note] innodb:waiting for purge to start
2016-05-16 18:31:26 5934 [Note] innodb:5.6.30 started; Log sequence number 0
A random root password has been set. You'll find it in '/root/.mysql_secret '.
2016-05-16 18:31:27 5934 [Note] Binlog End
2016-05-16 18:31:27 5934 [Note] innodb:fts optimize thread exiting.
2016-05-16 18:31:27 5934 [Note] innodb:starting shutdown ...
2016-05-16 18:31:28 5934 [Note] Innodb:shutdown completed; Log sequence Number 1625977
2016-05-16 18:31:28 0 [Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-16 18:31:28 0 [Note]/usr/sbin/mysqld (mysqld 5.6.30) starting as Process 5956 ...
2016-05-16 18:31:28 5956 [Note] innodb:using Atomics to ref count buffer pool pages
2016-05-16 18:31:28 5956 [Note] innodb:the InnoDB memory heap is disabled
2016-05-16 18:31:28 5956 [Note] innodb:mutexes and rw_locks use GCC atomic builtins
2016-05-16 18:31:28 5956 [Note] innodb:memory barrier is not used
2016-05-16 18:31:28 5956 [Note] innodb:compressed tables use zlib 1.2.3
2016-05-16 18:31:28 5956 [Note] innodb:using Linux native AIO
2016-05-16 18:31:28 5956 [Note] innodb:using CPU CRC32 Instructions
2016-05-16 18:31:28 5956 [Note] innodb:initializing buffer pool, size = 128.0M
2016-05-16 18:31:28 5956 [Note] innodb:completed initialization of buffer pool
2016-05-16 18:31:28 5956 [Note] innodb:highest supported file format is Barracuda.
2016-05-16 18:31:28 5956 [Note] innodb:128 rollback segment (s) is active.
2016-05-16 18:31:28 5956 [Note] innodb:waiting for purge to start
2016-05-16 18:31:28 5956 [Note] innodb:5.6.30 started; Log sequence Number 1625977
2016-05-16 18:31:28 5956 [Note] Binlog End
2016-05-16 18:31:28 5956 [Note] innodb:fts optimize thread exiting.
2016-05-16 18:31:28 5956 [Note] innodb:starting shutdown ...
2016-05-16 18:31:30 5956 [Note] Innodb:shutdown completed; Log sequence Number 1625987
A RANDOM PASSWORD have BEEN SET for the MySQL root USER!
You'll find that password in '/root/.mysql_secret '.
You must change this password on your first connect,
No other statement but ' SET PASSWORD ' would be accepted.
See the Manual for the semantics of the ' password expired ' flag.
Also, the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
Which would also give you the option of removing the test database.
This is the strongly recommended for production servers.
See the Manual for more instructions.
Problems at http://bugs.mysql.com/
The latest information about MySQL was available on the Web at
Http://www.mysql.com
Support for MySQL by buying support/licenses at http://shop.mysql.com
New Default Config file was created as/usr/my.cnf and
Would be used by default by the server when you start it.
You could edit this file to the Change server settings
Start MySQL:
Service MySQL Start
To view the default password:
Cat/root/.mysql_secret
# The random password set for the root user at Mon 18:31:26 (local time): Uc33bridiw2e_9us
Lr_i88lp6egm18fp
To set the root password:
Mysql-u Root
Mysql>set Password=password (' Rootfllg ');
Mysql>flush privileges;
mysql>exit;
/usr/bin/mysqladmin-u root password ' new-password '
/usr/bin/mysqladmin-u root-h wiki password ' New-password '
To test the MySQL daemon:
Cd/usr/share/mysql-test
Perl mysql-test-run.pl
Safety reinforcement:
/usr/bin/mysql_secure_installation
Note:running all PARTS of this SCRIPT are 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 would be blank,
So, should just press ENTER here.
Enter current password to root (enter for none): Uc33bridiw2e_9us
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 has a root password set so that you can safely answer ' n '.
Change the root password? [y/n] Y
New password:su********
Re-enter New password:su********
Password Updated successfully!
Reloading privilege tables.
... success!
By default, a MySQL installation have an anonymous user, allowing anyone
To log into MySQL without has to has a user account created for
them. This was intended only for testing, and the installation
Go a bit smoother. You should remove them before moving into a
Production environment.
Remove anonymous users? [y/n] Y
... success!
Normally, Root should only is allowed to connect from ' localhost '. This
Ensures that someone cannot guess at the root of password from the network.
Disallow Root login remotely? [y/n] Y (There is a bug here, the root login permissions are all removed, because the default root user can only be accessed via localhost)
... success!
By default, MySQL comes with a database named ' test ' that anyone can
Access. This was also intended only for testing, and should be removed
Before moving into a production environment.
Remove test database and access to it? [y/n] Y
-Dropping test database ...
... success!
-Removing privileges on test database ...
... success!
Reloading the privilege tables would ensure that all changes made so far
would 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 is secure.
Thanks for using mysql!
Cleaning up ...
To move the MySQL data directory:
Service MySQL Stop
Cd/var/lib/mysql
MV mysql//data/mysql/
To modify a configuration file:
Vi/usr/my.cnf
# for advice The change settings
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[Mysqld]
# Remove Leading # and set to the amount of RAM for the most important data
# Cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove Leading # to turn on a very important data integrity option:logging
# Changes to the binary log between backups.
# Log_bin
# These is commonly set, remove the # and set as required.
# Basedir = ...
DataDir =/data/mysql/
# port = .....
# server_id = ...
Socket =/data/mysql/mysql.sock
# Remove Leading # To set options mainly useful for reporting servers.
# The server defaults is faster for transactions and fast selects.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
Sql_mode=no_engine_substitution,strict_trans_tables
To start the MySQL service:
Service MySQL Start
Skip permission control and log in to MySQL as an administrator:
Service MySQL Stop
Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
Mysql
Mysql>
To view User rights:
Mysql-uroot-p
Mysql>select host,user from user where user= "root";
Mysql>select Host,user,password from user;
To forget the root password, restore the steps:
Service MySQL Stop
Mysqld_safe--skip-grant-tables &
Mysql-uroot
Mysql>update Mysql.user Set Password=password (' MyPassword ') whereuser= ' root ';
Mysql>flush privileges;
Mysql>quit
Service MySQL Start
Mysql–uroot–p
Allow the root user remote access when there are other privileged users who can log in to MySQL:
Mysql–u username
Mysql>update mysql.user Setpassword=password ("New_password") where user= ' root ' and host= ' localhost ';
Mysql> Grant All on * * to [e-mail protected] ' localhost ' identified by ' YourPassword ';
Mysql> Grant All on * * to [e-mail protected] '% ' identified by ' YourPassword ';
Mysql>flush privileges;
mysql>exit;
If the newly installed MySQL performs security hardening script mysql_secure_installation, it will cause the user table to be the case, and the root user cannot log on to MySQL from this machine. You can only reload MySQL with the following reload steps:
1. Uninstall MySQL Package
Rpm–qa | grep MySQL
Mysql-shared-compat-5.6.30-1.el6.x86_64
Mysql-client-5.6.30-1.el6.x86_64
Mysql-server-5.6.30-1.el6.x86_64
Mysql-shared-5.6.30-1.el6.x86_64
Mysql-devel-5.6.30-1.el6.x86_64
Rpm–e mysql-server-5.6.30-1.el6.x86_64
2. Delete related files
Rm-rf/var/lib/mysql/mysql (delete data file)
Rm-f/root/.mysql_secure (Delete the default root password file to regenerate the default password when the RPM package is installed, even if the root password has been changed)
3. Reinstall MySQL
RPM–IVH mysql-server-5.6.30-1.el6.x86_64.rpm
4. Change the root password
Service Mysqlstart
Cat/root/.mysql_secure
Mysql-uroot–p
Mysql>setpassword=password ('password');
MySQL installation configuration