Operating mysql in linux

Linux operation mysql:
1. Start mysql service: service start/stop mysql
2. Log in to mysql: mysql -uroot -p
      mysql -u root -h localhost -p
3. Query mysql permission information:
     select user,host from mysql.user;
4. Add mysql to the system service and set the startup
   to join the system service: chkconfig --add mysql
    auto-start: chkconfig mysql on
5. Modify the mysql password
    and enter the following command after logging in to mysql:
    set password = password('root' );
6. Enable mysql remote login
   By default, mysql does not support remote login to mysql for security reasons, so you need to set
   the permission to enable remote login to mysql.
   After logging in to mysql, enter the following command:
   grant all privileges on *.* to 'root' @'%' identified by 'root';
   flush privileges;
7. Open Linux external access port 3306
  /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
  /etc/rc.d/init.d/iptables save --- permanently save changes to the firewall

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326271930&siteId=291194637