Online installation and configuration of mysql under centos

Online installation and configuration of mysql under centos
  1. Install the mysql server
  [java]
  yum -y install mysql-server
  2. Load the service start service
  [java]
  /etc/rc.d/init.d/mysqld start
  3. Set the mysql service to start Self-starting
  [java]
  chkconfig mysqld on
  If you are not sure whether it has been set to start automatically at boot, you can view it with the following command
  [java]
  chkconfig --list mysqld
  (mysqld 0:off 1:off 2:on 3:on 4:on 5 :on 6:off) ← If 2--5 is on, it is OK
  4. View the current mysql version information
  [java]
  mysql –version
  5. Modify the mysql default encoding
  [java]
  vi
  /etc/my.cnf ] added under:
  [java]
  default-character-set=utf8
  added under [mysqld]:
  [java]
  character-set-server = utf8
  init_connect='set names utf8'
  Enter mysql to view the current encoding
  [java]
  mysql>show variables like '%character%';
  6. Set access permissions and passwords
  [java]
  mysql> grant all privileges on *.* to 'root'@'%' identified by '123';
  mysql> grant all privileges on *.* to 'root'@'localhost' identified by '123';
  mysql> flush privileges;
  can be viewed through the following code The currently set access permission status
  [java]
  select * from mysql.user;
  7. Restart the mysql service
  [java]
  /etc/init. d/mysqld restart
  8. Completely uninstall mysql
  [java]
  yum remove mysql mysql-server mysql-libs compat-mysql51
  rm -rf /var/lib/mysql
  rm /etc/my.cnf
  to see if there is still mysql software
  [java]
  rpm -qa|grep mysql//If yes, continue to delete
  rpm -ql mysql//Check the file location

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326794892&siteId=291194637