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 学習者の迅速な成長を支援します!