Home  >  Article  >  Database  >  Solutions to common mysql problems during development

Solutions to common mysql problems during development

不言
不言forward
2019-01-07 10:24:084212browse
This article brings you solutions to common problems in MySQL during the development process. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Record the mysql-related problems and solutions encountered during the development process, and update them in the long term.

Remote connection problem

Mysql default connection can only be given to the local (localhost or 127.0.0.1). If you want a certain IP address to access mysql, You need to manually enable this permission

Method:

  • Enter the terminal

  • Assign a new user

grant all privileges on *.* to 'username'@'IP address' identified by 'password';

  • Refresh permissions

flush privileges;

If you want all machines on the LAN to be able to connect to the mysql database, you can execute the following command
grant all privileges on *.* to 'username'@'%' identified by 'password' with grant option;

  • all privileges refers to all permissions, and can also be written as select, utdate, etc.

  • *.* refers to the database All tables

  • IP address: IP address allowed to connect, % is allowed for all machines in the LAN

Reserved word problem

MySQL reserved words like index should be avoided as much as possible in development. If index is used, then the SQL will be processed through back-single quotes ``(the key below Esc)

Table case problem

Mysql does not distinguish the case of table names under the windows system, but under the linux system mysql indicates that it is case-sensitive. In Linux, mysql is not case-sensitive. Write:

  • Log in as root, modify /etc/my.cnf

  • Add a line under [mysqld]: lower_case_table_names=1

  • Restart mysql

The above is the detailed content of Solutions to common mysql problems during development. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete