Wednesday, April 22, 2015

Short article about installation mysql-server on centos7.(default maria-db yum repo)

#Centos7 replaced oracle mysql with maria-db.
#When have to install mysql-server, this short article will help me or you.
#This process shows the oracle mysql server install using repo of oracle's.
#There is no database on this server yet.

[root@ct7 mysql-repo]# mkdir mysql-repo
[root@ct7 mysql-repo]# cd mysql-repo/
[root@ct7 mysql-repo]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

[root@ct7 mysql-repo]# yum update
[root@ct7 mysql-repo]# yum install mysql-community-server

[root@ct7 mysql-repo]# service mysql start
Redirecting to /bin/systemctl start  mysql.service
[root@ct7 mysql-repo]# systemctl start mysql
[root@ct7 mysql-repo]# ps -ef | grep mysql
mysql     4193     1  0 10:53 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql     4344  4193  0 10:53 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root      4372  3841  0 10:54 pts/0    00:00:00 grep --color=auto mysql
[root@ct7 mysql-repo]# systemctl stop mysql
[root@ct7 mysql-repo]# ps -ef | grep mysql
root      4381  3841  0 10:54 pts/0    00:00:00 grep --color=auto mysql
[root@ct7 mysql-repo]# service mysql start
Redirecting to /bin/systemctl start  mysql.service
[root@ct7 mysql-repo]# ps -ef | grep mysql
mysql     4404     1  0 10:55 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql     4554  4404  8 10:55 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root      4580  3841  0 10:55 pts/0    00:00:00 grep --color=auto mysql

 #Setting root password of mysql and   deleting unnecessary  account and database.e

[root@ct7 mysql-repo]# 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.

Set 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] y
 ... Success!

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] y
 ... Success!

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] y
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

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...


#INSTALLING PHP
[root@ct7 mysql-repo]# sudo yum install php php-mysql -y





 #INSTALLING APACHE HTTPD.
[root@ct7 mysql-repo]# yum -y install httpd

 [root@ct7 mysql-repo]# service httpd start
Redirecting to /bin/systemctl start  httpd.service


[root@ct7 mysql-repo]# vi /var/www/html/index.php

 <?php
phpinfo();
?>
~   
#With browser
#http://hostname-or-ip/index.php


























No comments:

Post a Comment