I love Java Series --- [Linux system installed MySql Database]

Linux systems deployed MySQL database

  • linux linux version of MySQL uploaded to the system in the / usr / itheima down

  • Before you install mysql, first uninstall the system comes with MySQL

    • grep mysql | query whether the system has been installed MySQL rpm -qa

    • Uninstall MySQL rpm -e --nodeps mysql-libs-5.1.71-1.el6.i686

  • MySQL archive decompression

    • MySQL rpm packages extract the files stored in the mysql directory under a new directory mkdir mysql

    • tar -xvf MySQL-5.6.22-1.el6.i686.rpm-bundle.tar -C mysql

    • -C represents the extract to extract the files stored in the specified directory, storage directory must exist.

  • rpm command to install mysql database, cd mysql execute the following command:

    • MySQL database server installation rpm -ivh MySQL-server-5.6.22-1.el6.i686.rpm

    • MySQL database client installation rpm -ivh MySQL-client-5.6.22-1.el6.i686.rpm

    • Start MySQL service service mysql start

    • MySQL service added to the system chkconfig --add mysql (optional)

    • Follow the system start chkconfig mysql on (optional)

  • Log in as root mysql, and set the root password

    • MySQL is first installed random password: /root/.mysql_secret saved in this file, view the password

    • Log in MySQL, mysql -uroot -pxxxxxx

    • After logging is recommended to set the root password: use the mysql command: set password = password ( 'root')

  • Authorized remote connections

    • By default mysql root user can only access the local superuser root mysql is not remote login, you need to set the root user privileges to open Telnet remote access mysql in%

    • grant all privileges on *.* to 'root' @'%' identified by 'root';

      flush privileges;   -- 更新授权。
  • By the same token, we have remote access to the system under linux mysql database, you need to open port 3306, or remote connection is not on Oh!

    • /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

    • /etc/rc.d/init.d/iptables save

  • Close and open the firewall (to understand)

  • CentOS configuration operation example of the firewall (start, stop, open and close the port): 
    Note: the firewall basic operation command: 
    Query firewall status: [the root @ localhost ~ ] #-Service iptables Status 
    Stop Firewall: [the root @ localhost ~ ] #-Service iptables stop 
    start the firewall: [root @ localhost ~ ] # iptables start Service 
    to restart the firewall: [root @ localhost ~ ] # Service iptables restart 
    permanently turn off the firewall: [root @ localhost ~] # chkconfig iptables OFF

     

Guess you like

Origin www.cnblogs.com/hujunwei/p/11297060.html