Home Database Mysql Tutorial MySQL大小写敏感问题和命名规范_MySQL

MySQL大小写敏感问题和命名规范_MySQL

Jun 01, 2016 pm 01:40 PM
folder article

bitsCN.com
MySQL大小写敏感问题和命名规范 注:本文大部内容参考自互联网相关文章 1.MySQL大小写敏感规则   MySQL中,一个库会对应一个文件夹,库里的表会则以文件的方式存放在文件夹内,所以,操作系统对大小写的敏感性决定了数据库和表的大小写敏感(MySQL有一个只读的系统变量lower_case_file_system,其值反映的正是当前文件系统是否区分大小写)因此:在Windows下Mysql的数据库和表名是大小写不敏感的,而在大多数类型的Unix系统中是大小写敏感的。 以下是MySQL详细的大小写区分规则: 在Linux下: 1、数据库名与表名是严格区分大小写的;2、表的别名是严格区分大小写的;3、列名与列的别名在所有的情况下均是忽略大小写的;4、变量名也是严格区分大小写的;  在Windows下: 全部不区分大小写   补充:1.MySQL中有一个系统变量:lower_case_table_names,专门用来配置是否区分据库名与表名的大小写。 如果你的系统是Windows,而你又希望mysql能够区分大小写,那么你可以在my.ini文件中,在[mysqld]一节的最后,加入如下部分:
 [plain]#If set to 0, table names are stored as specified and comparisons are case sensitive.  #If set to 1, table names are stored in lowercase on disk and comparisons are not case sensitive.   #If set to 2, table names are stored as given but compared in lowercase. This option also applies to database names and table aliases.  lower_case_table_names=0   2.MySQL在查询字符串时是大小写不敏感的。如某字段值需要区分大小写,可在定义该字段时指定BINARY属性。 2.一种MySQL命名规范   为了避免大小写引发的问题,一种推荐的命名规则是:在定义数据库、表、列的时候全部采用小写字母加下划线的方式,不使用任何大写字母。 3.关于Hibernate/JPA数据库schema自动映射的问题
 使用Hibernate/JPA的工程可以自动生成数据库的schema,由于java有着自己的类与字段命名规则,这与mysql推荐的命名规则不太相符,于是出现了follow哪一种命名规范的问题。一般来说这会由团队和DBA协商确定,使用mysql的命名规范不会出现大小写带来的问题,对于DBA来说可能也更加友好,而使用java的命名规范则对开发人员来说无疑是更加友好的,这将省去列名的映射配置,同时也方便开发人员查看数据库。如果你的项目使用了后者,你最好像上面讲到的,设置一下lower_case_table_names=0。
  bitsCN.com

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
How to have files automatically copied to another folder on Windows 11/10 How to have files automatically copied to another folder on Windows 11/10 Feb 19, 2024 am 11:24 AM

In this article, we will show you how to automatically copy files to another folder on Windows 11/10. Creating backups is necessary to avoid data loss. Data loss can occur due to many reasons such as hard drive corruption, malware attack, etc. You can back up your data manually by using copy and paste method or using third-party tools. Did you know you can automatically back up data on your Windows computer? We'll show you how to do this in this article. How to have files automatically copied to another folder on Windows 11/10 How to use Task Scheduler to automatically copy files and folders to another destination folder on Windows 11/10? This article will provide you with detailed guidance. please

Where is the Win11 background image stored? Where is the Win11 background image stored? Dec 27, 2023 am 11:59 AM

The win11 system has updated a lot of new wallpapers for everyone, so many users are curious about which folder the win11 wallpapers are in and want to open them to see the wallpapers inside. Therefore, we have brought a tutorial so that you can enter and view the wallpapers. . Which folder is the win11 wallpaper in: 1. The system comes with wallpaper: 1. First enter my computer, and then open the path: C:\Windows\Web\Wallpaper. 2. Then enter the windows folder and you can see the wallpapers that come with the system. 2. User-saved wallpapers: 1. Wallpapers installed by users will be saved in: C:\Users (user)\xx (current user name)\AppData\Local\Microso

How to detail the location of the win10 theme folder How to detail the location of the win10 theme folder Dec 27, 2023 pm 09:37 PM

Recently, many friends feel that the theme of Win10 does not meet their own aesthetics and want to change the theme. After downloading it online, they find that the folder cannot be found. Then the editor will show you how to find the folder of the Win10 theme. Which folder is the win10 theme in? 1. The default storage path location of Win10 system wallpapers: 1. Microsoft saves these pictures in the path C:\Windows\Web\Wallpaper. Under it are the default saves of pictures with three different themes. Location, 2, flowers and lines and colors theme pictures are also saved in the folder with the same name! The naming principle is imgXXX. We only need to follow this principle to change the name of the related image we want to set and paste the image into

One or more items in the folder you synced do not match Outlook error One or more items in the folder you synced do not match Outlook error Mar 18, 2024 am 09:46 AM

When you find that one or more items in your sync folder do not match the error message in Outlook, it may be because you updated or canceled meeting items. In this case, you will see an error message saying that your local version of the data conflicts with the remote copy. This situation usually happens in Outlook desktop application. One or more items in the folder you synced do not match. To resolve the conflict, open the projects and try the operation again. Fix One or more items in synced folders do not match Outlook error In Outlook desktop version, you may encounter issues when local calendar items conflict with the server copy. Fortunately, though, there are some simple ways to help

How to set password for win11 computer folder How to set password for win11 computer folder Jan 12, 2024 pm 02:27 PM

After updating to the latest win11 system, most friends don't know how to encrypt their folders to protect privacy, so we have brought you a method. Let's take a look at how to set a password for a win11 computer folder. How to set a password for a win11 computer folder: 1. First find the folder you want to encrypt. 2. Then right-click the folder and select "Properties". 3. Click "Advanced" under Properties. 4. Check "Encrypt content to protect data" in the menu and click OK. 5. Finally, return to the properties of the folder and click "OK" in the pop-up window.

There are two Windows folders in the C drive; what should I do? There are two Windows folders in the C drive; what should I do? Mar 06, 2024 am 11:55 AM

The Windows folder contains the Windows operating system and is an important folder in a Windows computer. By default, Windows is installed on the C drive. Therefore, C is the default directory for Windows folders. Every Windows computer has a Windows folder. However, some users reported that two Windows folders were found in the C drive. In this article, we will explain what you can do if you encounter such a situation. Two Windows folders in C drive It is rare to have two Windows folders in C drive. However, if you encounter such a situation, you can use the following suggestions: Run an anti-malware scan to try to find the correct

How to create a folder on Realme Phone? How to create a folder on Realme Phone? Mar 23, 2024 pm 02:30 PM

Title: Realme Phone Beginner’s Guide: How to Create Folders on Realme Phone? In today's society, mobile phones have become an indispensable tool in people's lives. As a popular smartphone brand, Realme Phone is loved by users for its simple and practical operating system. In the process of using Realme phones, many people may encounter situations where they need to organize files and applications on their phones, and creating folders is an effective way. This article will introduce how to create folders on Realme phones to help users better manage their phone content. No.

Find the default folder path and sharing details of win11 wallpapers Find the default folder path and sharing details of win11 wallpapers Jan 30, 2024 pm 03:15 PM

Many users change wallpapers when using their computers. I believe many users are also asking which folder the win11 wallpapers are in? The wallpapers that come with the system are in Wallpaper under the C drive, and the wallpapers saved by users are in the Themes folder of the C drive. Let this site carefully introduce the win11 default wallpaper path sharing for users. Share win11 default wallpaper path 1. The system comes with wallpaper: 1. First enter my computer, and then open the path: C: Windows Web Wallpaper. 2. User-saved wallpapers: 1. Wallpapers installed by users will be saved in: C: Users (user) xx (current user name) AppDataLocalM

See all articles