Linux07 – Install MySQL

①Check the work

  CentOS6

rpm -qa|grep mysql or rpm -qa | grep mysql

  If mysql-libs exists The old version package is as follows:

  Share a picture

   must be Perform uninstallation! ! ! Uninstall command: rpm -e –nodeps mysql-libs

  CentOS7

  rpm -qa|grep mariadb

  If it exists as follows:

  Share a picture

  , you must uninstall it! ! ! Uninstall command: rpm -e –nodeps mariadb-libs

Check the permissions of the /tmp folder

Execute: chmod -R 777 /tmp

②Install MySQL

  a. Copy the installation package to the opt directory

    MySQL-client-5.5.54-1.linux2.6.x86_64.rpm

    MySQL-server -5.5.54-1.linux2.6.x86_64.rpm

  b, execute the following command to install

    rpm -ivh MySQL-client-5.5.54-1.linux 2. 6.x86_64.rpm

    rpm -ivh MySQL-server-5.5.54-1.linux2.6.x86_64.rpm

③Check if the installation is successful

  Check the MySQL version after the installation is complete

  Execute mysqladmin -version, if the message is printed out, it means success

  Share a picture

   or query rpm through rpm –qa|grep –i mysql (-i means ignore case)

④MySQL service Start and stop

   start: service mysql start

   stop: service mysql stop

⑤Set the password of the root user

  mysqladmin -u root password’root’    (set the user name and password by yourself)

⑥Log in to MySQL

  mysql -uroot -proot

⑦ Build a database

  Create database Database name

⑧Create table

  create table Table name (field name Field type (length) constraint…)

⑨Character set issue

h3>

  a, check the character set show v ariables like’character%’;

  b, check the installation location of MySQL.

  share picture

  c, modify the character set

     copy my-huge.cnf in /usr/share/mysql/ to /etc/ and change the name Is my.cnf

Tips: When mysql starts, it will read the /etc/my.cnf file first.

    Add related character set settings in [client] [mysqld] [mysql]

  [client]

< span style="color: #0000ff;">default-character-set=utf8

  [mysqld]

character_set_server=utf8


character_set_client
=utf8

collation
-server=utf8_general_ci

  [mysql]

default-character-set=utf8

  d, restart the MySQL service, check the character set command: service mysql restart

  e, modify The character set of the existing library table

      Modify the character set of the library

      alter database library name character set’utf8′;

    Modify the character set of the table f.

    alt table table name convert to character set’utf8′;

⑩remote access

  1. The default root user of MySQL only allows local login, remote You can’t log in through the SQLyog tool.

  2, view the user table in the MySQL mysql library

     Column display: select * from user\G; (If an error is reported Add mysql.)

    Share a picture

     Query commonly used fields: select host,user,password,select_priv from mysql.user;

    share picture

  3. Create a root user that can be accessed remotely and grant all privileges

    grant all privileges on * .* to [email protecte d]’%’ identified by’root’; (write your username and password here, be careful not to display Chinese symbols)

    share picture

     The query again shows that it is any ip, indicating that the permission is granted successfully

    share picture

  4. Modify the user’s password

     Modify the current user password    set password =password(‘root’)

     modifya user’s password update mysql.user set password=password(‘root’) where user=’hupo’; (set by yourself)

  5. Note: All modifications through the user table must use the flush privileges command to take effect.

default-character-set=utf8

character_set_server=utf8


character_set_client
=utf8

collation
-server=utf8_general_ci

default-character-set=utf8 

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5087 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.