Installer par exemple les packages Ubuntu avec synaptic ou apt :
sudo apt install mysql-server mysql-server-8.0 mysql-server-core-8.0 mysql-client mysql-client-8.0 mysql-client-core-8.0 mysql-common
richer@zentopia:\$ sudo mysql
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '$Sensei70';
mysql> exit
On sécurise ensuite l'installation de MySQL :
richer@zentopia:\$ sudo mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : n
... skipping.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
On crée un utilisateur ccp_user qui va permettre de gérer la base de données ccp (Clients Commandes Produits) avec Symfony :
richer@zentopia:\$ sudo mysql -u root -p
mysql> create user 'ccp_user'@'localhost' identified by '!Ccp_user1';
mysql> grant all privileges on *.* to 'ccp_user'@'localhost';
mysql> flush privileges;
mysql> quit
L'utilisateur ccp_user pourra créer la base de données (create database) ainsi que les tables associées et pourra également insérer, modifier ou supprimer des enregistrements.
Dernière étape : on relance MySQL pour prendre en compte les modifications :
richer@zentopia:\$ sudo service mysql restart