MySQL programming diary: remote access and Chinese garbled related issues

MySQL remote access issues

1.sudo vim mysql.conf.d/mysqld.cnf 注掉 #bind-address = 127.0.0.1

2. Log in and enter mysql-server:/etc/mysql$ mysql -uroot -p

  Enter password:

  mysql> use mysql

  mysql> update user set Host = '%' where user = 'root';

  GRANT ALL PRIVILEGES ON *.* TO'root'@'%' IDENTIFIED BY'lixiul' WITH GRANT OPTION; //Authorization comes from any machine, you can log in to the mysql server with the username root and the password lixiul

  FLUSH PRIVILEGES; //Save changes  

3. service mysql restart //Restart the mysql service

MySQL Chinese garbled problem

1 Modify /etc/mysql/my.cnf and add the following content

[mysqld]

character-set-server=utf8

[mysql.server]

default-character-set=utf8

[client]

default-character-set=utf8

[mysql]

default-character-set=utf82 重启mysqlservice mysql restart3 进入mysqlmysql>  SHOW VARIABLES LIKE 'character_%';

+--------------------------+----------------------------+

| Variable_name            | Value                      |

+--------------------------+----------------------------+

| character_set_client    | utf8                      |

| character_set_connection | utf8                      |

| character_set_database  | utf8                      |

| character_set_filesystem | binary                    |

| character_set_results    | utf8                      |

| character_set_server    | utf8                      |

| character_set_system    | utf8                      |

| character_sets_dir      | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

8 rows in set (0.00 sec)

mysql>

 


In addition, if you want to better improve your programming ability, learn C language and C++ programming! Overtaking in a curve, one step faster! I may be able to help you here~

UP has uploaded some video tutorials on learning C/C++ programming on the homepage. Those who are interested or are learning must go and take a look! It will be helpful to you~

Sharing (source code, actual project video, project notes, basic introductory tutorial)

Welcome partners who change careers and learn programming, use more information to learn and grow faster than thinking about it yourself!

Programming learning:

Programming learning:

Guess you like

Origin blog.csdn.net/weixin_45713725/article/details/115302177