찾다
데이터 베이스MySQL 튜토리얼MySQL defaults evolution_MySQL

MySQL, the original brand, the one developed by the MySQL team at Oracle, is steadily evolving. You can feel it if you try every new release that comes out of the milestone release cycle. Or even if you don’t try all of them, just testing a release once in a while gives you something to think about.

The engineers at Oracle are trying hard to improve the defaults. If you are theout-of-the-boxtype, and just install the new version on top of the previous one, leaving the same setup in place, you may be up for a for a few surprises. It’s the marketing, see? They tell you that just by replacing your old MySQL (5.1 or 5.5) with MySQL 5.6 you get 30% to 70% performance improvement. Which happens to be true, not only because the server is better, but also because they have changed the defaults. However, this change in defaults may come with some serious consequences for the ones who skip the release notes.

An annoying consequence of the MySQL team focusing on security is that in MySQL 5.6 you get amandatory warning if you use a password in the command line. On one hand, it’s a good thing, because they force you to use better security practices. On the other hand, it’s a royal PITA, because many applications are broken because of this warning, just by replacing MySQL 5.1 or 5.5 with 5.6. There are solutions. For example, you can adopt the newmysql_config_editorto handle your password, but that would break compatibility with previous MySQL versions. Rewriting complex procedures to use configuration files instead of username and passwords is tricky, especially if you are testing exactly the behavior of using a password on the command line to override the contents of an options file.

INTERMISSION: this is a point of contention with the MySQL team. They have started a trend of introducing features that will prevent working smoothly with previous versions of MySQL. Up to MySQL 5.5, installing a server and staring using it was a set of steps that would work in the same way regardless of the version. With MySQL 5.6, all bets are over. When you install a new server, you get along list of unwanted messages to the error output(which is fortunatelyfixed in MySQL 5.7), and then you get the warning if you use a password on the command line. For me, and for many developers who build software related to MySQL, the ability of writing a piece of software thatworks well with any versionis paramount. The MySQL team seems to think that users will be happy to throw everything to the wind and start writing new code for MySQL 5.6 only instead of reusing what was working until the month before. And let’s be clear: I fully understand the need of moving forward, but I don’t understand the need of trapping users in the new behavior without remedy.

Back to the defaults. What else is new? One good improvement in MySQL 5.6 is a change in the default value forSQL_MODE. Up to MySQL 5.5, it was an empty string. In MySQL 5.6.6 and later it is ‘NO_ENGINE_SUBSTITUTION.’ Can this change have side effects? Yes. Code that worked before may break. IMO, it’s a good thing, because getting an error when trying to create a table of a non-existing engine is better than having the table created silently with the default engine. I can, however, think of at least one case where a silent substitution is desirable, as I have seen in action at a customer’s deployment. That aside, one wonders why they did not go the extra mile and add STRICT_TRANS_TABLES (or even STRICT_ALL_TABLES) to the default. It turned out that they did it… and didn’t. When you install a new data directory using mysql_install_db, the procedure creates a my.cnf file in the $BASEDIR (the place where your mysql tarball was expanded), containing the line

<code>sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES </code>

However, if you have skipped the release notes, you will be left wondering where does this additional directive come from, since the manual mentions only one of them, and SHOW VARIABLES tells you that SQL_MODE contains two values.

MySQL 5.7 has also changed something. There is a lot of cleanup going on. Options and variables that were deprecated long ago suddenly disappear. Did you ever use ‘key-buffer’ as a short for ‘key-buffer-size’? If you did, that directive in the my.cnf won’t work anymore. (I could not find it in the release notes, but the test suite for MySQL Sandbox suddenly stopped working when I tried MySQL 5.7 and then I realized what was happening.) More to the point, though, is the installation procedure. In MySQL 5.6 there is a–random-passwordsoption that generates a random password for the server, and you can’t do anything with root until you use such random password to access the server and change the password to something else. This is an improvement over the old and despicableroot without password, which has been the default since the very beginning of MySQL, and it’s been the source of many security nightmares and interesting bugs. In MySQL 5.7.4, this behavior, i.e. thegeneration of a random password during the installation, is now the default. It is good news, because the old behavior was a disaster, but if you have an automated way of dealing with installation, there will be more hard work in front of you to handle the changes. The implementation is not script friendly, and definitely nightmarish if you want to install several instances of the server in the same host. What happens when you install MySQL 5.7.4? The installation software generates a random password, and writes it to a file named .mysql_secret in your $HOME directory. A sample file that was created by the installer would be:

<code># The random password set for the root user at Mon Mar 31 10:16:54 2014 (local time):2X7,S4PGkIg=H(lJEOF</code>

If you wanted a script to read the password generated by this procedure, it would be a mistake to look for the second line. In fact, if you repeat the installation on the same host, you get something like this:

<code># The random password set for the root user at Mon Mar 31 10:16:54 2014 (local time):2X7,S4PGkIg=H(lJ# The random password set for the root user at Tue Apr 29 09:35:07 2014 (local time):_S07zDt7dQ=,sxw9# The random password set for the root user at Tue Apr 29 09:42:19 2014 (local time):r[yn4ND$-5p,4q}5EOF</code>

Then the correct approach would be looking for the last non empty line in the file. However, if you were installing several instances in the same host (such asMySQL Sandboxdoes) you wouldn’t be able to find which password belongs to which server. Admittedly, multiple instances of the same server is not what most users do, but since it breaks MySQL Sandbox, which is used by many, I mention it here. BTW, MySQL Sandbox 3.0.44 has a temporary fix for this behavior. If you install MySQL 5.7.4 or later, it will include –skip-random-passwords, and defaults to the old password-less installation. There is a hackish workaround for the above uncompromising design and I will add it to MySQL Sandbox unless the next MySQL version introduces an optional path for the .mysql_secret file.

Summing up, there are mostly good improvements from the MySQL team, although the attention to usability is still low. They are whipping users into better security. A gentler approach would be appreciated. Sometimes I see a post from the community team asking for feedback on some feature being deprecated or modified. I would welcome such requests on matters that affect the default behavior of everyday tools.

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
MySQL : Blob 및 기타없는 SQL 스토리지, 차이점은 무엇입니까?MySQL : Blob 및 기타없는 SQL 스토리지, 차이점은 무엇입니까?May 13, 2025 am 12:14 AM

mysql'sblobissuilableforstoringbinarydatawithinareldatabase, whilenosqloptionslikemongodb, redis, and cassandraofferflexible, scalablesolutionsforunstuctureddata.blobissimplerbutcanslowwownperformance를 사용하는 것들보업 betterscal randaysand

MySQL 추가 사용자 : 구문, 옵션 및 보안 모범 사례MySQL 추가 사용자 : 구문, 옵션 및 보안 모범 사례May 13, 2025 am 12:12 AM

TOADDAUSERINMYSQL, 사용 : CreateUser'UserName '@'host'IdentifiedBy'Password '; 여기서'showTodoitseciRely : 1) ChoosetheHostCareLyTocon trolaccess.2) setResourcelimitswithOptionslikemax_queries_per_hour.3) Usestrong, iriquepasswords.4) enforcessl/tlsconnectionswith

MySQL : 문자열 데이터 유형을 피하는 방법 일반적인 실수?MySQL : 문자열 데이터 유형을 피하는 방법 일반적인 실수?May 13, 2025 am 12:09 AM

toavoidcommonmistakeswithstringdatatypesinmysql, stroundStringTypenuances, chooseTherightType, andManageEncodingAndCollationSettingSefectively.1) usecharforfixed-lengthstrings, varcharvariable-length, andtext/blobforlargerdata.2) setcarcatter

MySQL : 문자열 데이터 유형 및 열거?MySQL : 문자열 데이터 유형 및 열거?May 13, 2025 am 12:05 AM

mysqloffersechar, varchar, text, anddenumforstringdata.usecharforfixed-lengthstrings, varcharerforvariable 길이, 텍스트 forlarger 텍스트, andenumforenforcingdataantegritystofvalues.

MySQL Blob : Blobs 요청을 최적화하는 방법MySQL Blob : Blobs 요청을 최적화하는 방법May 13, 2025 am 12:03 AM

mysqlblob 요청 최적화는 다음 전략을 통해 수행 할 수 있습니다. 1. Blob 쿼리의 빈도를 줄이거나 독립적 인 요청을 사용하거나 지연로드를 사용하십시오. 2. 적절한 Blob 유형 (예 : TinyBlob)을 선택하십시오. 3. Blob 데이터를 별도의 테이블로 분리하십시오. 4. 응용 프로그램 계층에서 블로브 데이터를 압축합니다. 5. Blob Metadata를 색인하십시오. 이러한 방법은 실제 애플리케이션에서 모니터링, 캐싱 및 데이터 샤딩을 결합하여 성능을 효과적으로 향상시킬 수 있습니다.

MySQL에 사용자 추가 : 완전한 튜토리얼MySQL에 사용자 추가 : 완전한 튜토리얼May 12, 2025 am 12:14 AM

MySQL 사용자를 추가하는 방법을 마스터하는 것은 데이터베이스 관리자 및 개발자가 데이터베이스의 보안 및 액세스 제어를 보장하기 때문에 데이터베이스 관리자 및 개발자에게 중요합니다. 1) CreateUser 명령을 사용하여 새 사용자를 만듭니다. 2) 보조금 명령을 통해 권한 할당, 3) FlushPrivileges를 사용하여 권한이 적용되도록하십시오.

MySQL 문자열 데이터 유형 마스터 링 : Varchar vs. Text vs. CharMySQL 문자열 데이터 유형 마스터 링 : Varchar vs. Text vs. CharMay 12, 2025 am 12:12 AM

ChooseCharfixed-lengthdata, varcharforvariable-lengthdata, andtextforlargetextfields.1) charisefficientsconsentent-lengthdatalikecodes.2) varcharsuitsvariable-lengthdatalikeNames, 밸런싱 플렉스 및 성능

MySQL : 문자열 데이터 유형 및 인덱싱 : 모범 사례MySQL : 문자열 데이터 유형 및 인덱싱 : 모범 사례May 12, 2025 am 12:11 AM

MySQL에서 문자열 데이터 유형 및 인덱스를 처리하기위한 모범 사례는 다음과 같습니다. 1) 고정 길이의 Char, 가변 길이의 Varchar 및 큰 텍스트의 텍스트와 같은 적절한 문자열 유형 선택; 2) 인덱싱에 신중하고, 과도한 인덱싱을 피하고, 공통 쿼리에 대한 인덱스를 만듭니다. 3) 접두사 인덱스 및 전체 텍스트 인덱스를 사용하여 긴 문자열 검색을 최적화합니다. 4) 인덱스를 작고 효율적으로 유지하기 위해 인덱스를 정기적으로 모니터링하고 최적화합니다. 이러한 방법을 통해 읽기 및 쓰기 성능의 균형을 맞추고 데이터베이스 효율성을 향상시킬 수 있습니다.

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

VSCode Windows 64비트 다운로드

VSCode Windows 64비트 다운로드

Microsoft에서 출시한 강력한 무료 IDE 편집기

WebStorm Mac 버전

WebStorm Mac 버전

유용한 JavaScript 개발 도구

mPDF

mPDF

mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기