Myql Server (startup)

DOCS

https://dev.mysql.com/doc/refman/8.0/en/windows-install-archive.html

https://lefred.be/content/how-to-grant-privileges-to-users-in-mysql-8-0/

The ZIP archive does not include a data directory.

To initialize a MySQL installation by creating the data directory and populating the tables in the mysql system database,

initialize MySQL using either –initialize or –initialize-insecure.

#
bin\mysqld –initialize

Arranquem el servidor

If you omit the –console option, the server writes diagnostic output to the error log in the data directory (C:\Program Files\MySQL\MySQL Server 8.0\data by default).

The error log is the file with the .err extension, and may be set using the –log-error option.

#
bin\mysqld –console

mysql -u root -p
Enter password: (enter the random root password here)

(SRV-Terlas.err) . . .
2021-10-18T11:24:50.352518Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: %*mk0vq.gwcS

Si s’ha inicialitzat amb bin\mysqld –initialize-insecure
mysql -u root –skip-password

Un cop dins
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘root-password’;

Aturem el servei que s’ha iniciat desde consola

mysqladmin shutdown -u root -p

Instalem el servei (Amb administrador)

mysqld –install

Per borrar el servei (Amb administrador)

sc delete MySQL

Otorguem privilegis

GRANT ALL PRIVILEGES ON database_name.* TO ‘username’@’localhost’;

mysql> GRANT ALL PRIVILEGES ON octubre.* TO ‘root’@’%’;
ERROR 1410 (42000): You are not allowed to create a user with GRANT

Comenzando con MySQL 8 ya no puede (implícitamente) crear un usuario usando el GRANT comando.
Utilice CREATE USER en su lugar, seguido de la declaración GRANT :

mysql> CREATE USER ‘root’@’%’ IDENTIFIED BY ‘root’;
mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ WITH GRANT OPTION;

Millor amb root creem un nou usuari sense el grant option

mysql> CREATE USER ‘mysql’@’%’ IDENTIFIED BY ‘1234’;
mysql> GRANT ALL PRIVILEGES ON . TO ‘mysql’@’%’;


Quatre comandes bàsiques

show databases;
use ;
show tables;
desc ;
show create table \G

Per defecte quan creem una taula
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci


VCRUNTIME1040_1.dll not found
Microsoft Visual C++ 2015 – 2019 Redistributable

Fitxer de configuració

[mysqld]
# set basedir to your installation path
basedir=C:\\Users\\usuari2\\mysql
# set datadir to the location of your data directory
datadir=C:\\Users\\usuari2\\mydata\data
#
innodb_data_home_dir=C:\\Users\\usuari2\\mydata\ibdata
default-storage-engine=InnoDB

Aquesta entrada ha esta publicada en Uncategorized. Afegeix a les adreces d'interès l'enllaç permanent.

Deixa un comentari

Fill in your details below or click an icon to log in:

WordPress.com Logo

Esteu comentant fent servir el compte WordPress.com. Log Out /  Canvia )

Google photo

Esteu comentant fent servir el compte Google. Log Out /  Canvia )

Twitter picture

Esteu comentant fent servir el compte Twitter. Log Out /  Canvia )

Facebook photo

Esteu comentant fent servir el compte Facebook. Log Out /  Canvia )

S'està connectant a %s