Maison > base de données > tutoriel mysql > le corps du texte

How to Initialize a New MySQL Installation and Create New Da_MySQL

WBOY
Libérer: 2016-06-01 13:07:12
original
1058 Les gens l'ont consulté

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>
Copier après la connexion
scripts/mysql_install_db --basedir=. --datadir=databin/mysqld_safe --defaults-file=my.cnf &
Copier après la connexion

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';
Copier après la connexion

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
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!