How to Initialize a New MySQL Installation and Create New Da_MySQL

WBOY
풀어 주다: 2016-06-01 13:07:12
원래의
1058명이 탐색했습니다.

06.26.2014|5 views|

Related MicroZone Resources

INFOGRAPHIC: The Future of the Database

Proven in Production: Clustrix Case Studies

Clustrix Whitepapers

What We Offer: Clustrix Features

Like this piece? Share it with your friends:

|More

For a freshly installed MySQL server, you would need to initialize the system tables and data directory like this:

cd mysql-<version></version>
로그인 후 복사
scripts/mysql_install_db --basedir=. --datadir=databin/mysqld_safe --defaults-file=my.cnf &
로그인 후 복사

Before MySQL 5.6, this will setup a "root" with empty password that you can immediately login. For MySQL 5.7 however, it creates a random password for "root" user now. The password is generated under $HOME/.mysql_secret. You need to login and run "SET PASSWORD = PASSWORD('secret')" to change it. After above, you my login using "root" and start creating your own database and users. For example:

CREATE DATABASE mydb;GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%' IDENTIFIED BY 'secret';GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost' IDENTIFIED BY 'secret';
로그인 후 복사

Published at DZone with permission ofZemian Deng, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:
  • MySQL
  • Tips and Tricks
  • SQL
  • Tools & Methods
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!