UBUNTU SERVER 18.04 installare MySQL - PhpMyAdmin

programmazione & dintorni
Rispondi
admin
Site Admin
Messaggi: 205
Iscritto il: dom mar 20, 2016 9:24 pm

UBUNTU SERVER 18.04 installare MySQL - PhpMyAdmin

Messaggio da admin »

installazione MySQL
1)update the package index on your server with

Codice: Seleziona tutto

sudo apt update
2)Then install the default package:

Codice: Seleziona tutto

sudo apt install mysql-server
3)for fresh installations, you’ll want to run the included security script. This changes some of the less secure default options for things like remote root logins and sample users. On older versions of MySQL, you needed to initialize the data directory manually as well, but this is done automatically now.
Run the security script:

Codice: Seleziona tutto

sudo mysql_secure_installation
4)In Ubuntu systems running MySQL 5.7 (and later versions), the root MySQL user is set to authenticate using the auth_socket plugin by default rather than with a password. This allows for some greater security and usability in many cases, but it can also complicate things when you need to allow an external program (e.g., phpMyAdmin) to access the user.
In order to use a password to connect to MySQL as root, you will need to switch its authentication method from auth_socket to mysql_native_password. To do this, open up the MySQL prompt from your terminal:

Codice: Seleziona tutto

sudo mysql
Next, check which authentication method each of your MySQL user accounts use with the following command:

Codice: Seleziona tutto

SELECT user,authentication_string,plugin,host FROM mysql.user;
socket
socket
socket.JPG (40.69 KiB) Visto 31865 volte
In this example, you can see that the root user does in fact authenticate using the auth_socket plugin. To configure the root account to authenticate with a password, run the following ALTER USER command. Be sure to change password to a strong password of your choosing, and note that this command will change the root password you set in Step 2:

Codice: Seleziona tutto

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
(password con gli apici)

Then, run FLUSH PRIVILEGES which tells the server to reload the grant tables and put your new changes into effect:

Codice: Seleziona tutto

FLUSH PRIVILEGES;
Check the authentication methods employed by each of your users again to confirm that root no longer authenticates using the auth_socket plugin:

Codice: Seleziona tutto

SELECT user,authentication_string,plugin,host FROM mysql.user;
psw
psw
psw.JPG (42.47 KiB) Visto 31865 volte
You can see in this example output that the root MySQL user now authenticates using a password. Once you confirm this on your own server, you can exit the MySQL shell:

Codice: Seleziona tutto

exit
Testing MySQL

Codice: Seleziona tutto

systemctl status mysql.service
sql runn
sql runn
sql running.JPG (28.7 KiB) Visto 31865 volte
If MySQL isn’t running, you can start it with sudo systemctl start mysql.

For an additional check, you can try connecting to the database using the mysqladmin tool, which is a client that lets you run administrative commands. For example, this command says to connect to MySQL as root (-u root), prompt for a password (-p), and return the version.

Codice: Seleziona tutto

sudo mysqladmin -p -u root version
You should see output similar to this:
sql ok
sql ok
sql ok.JPG (42.25 KiB) Visto 31865 volte
This means MySQL is up and running.

from https://www.digitalocean.com/community/ ... untu-18-04


installazione PMA
1)Update the apt package tool to ensure we are working with the latest and greatest.

Codice: Seleziona tutto

sudo apt update

Codice: Seleziona tutto

sudo apt upgrade
2)install phpMyAdmin and PHP extensions for managing non-ASCII string and necessary tools
During this installation you’ll be asked for the webserver selection, we will select Apache2 and select ENTER.

Codice: Seleziona tutto

sudo apt install phpmyadmin php-mbstring php-gettext
3)Enable PHP extension

Codice: Seleziona tutto

phpenmod mbstring
4)If you’re running multiple domains on one server then you’ll want to configure your /etc/apache2/apache2.conf to enable phpMyAdmin to work

Codice: Seleziona tutto

sudo nano /etc/apache2/apache2.conf
Add:

Codice: Seleziona tutto

Include /etc/phpmyadmin/apache.conf
5)Restart the Apache service to recognize the changes made to the system.

Codice: Seleziona tutto

systemctl restart apache2
6)Verify phpMyAdmin installation by going to http://ip/phpmyadmin (username phpmyadmin).

from:https://www.liquidweb.com/kb/install-ph ... ntu-18-04/
Rispondi