Home > Centos, Server > Installare e configurare mysql-server in Centos 5.9 64 bit

Installare e configurare mysql-server in Centos 5.9 64 bit

Nell’installazione di mysql in Centos 5.9 64 bit vengono installati oltre al server mysql i clients i386 e x86_64. Il comando è il classico

yum install mysql mysql-server

Particolarmente verboso, al primo avvio di mysql, l’output a video in Centos 5.9 a 64 bit con riportati alcuni utili comandi.

service mysqld start

Configurazione

Password di root

Per impostare la password di root

/usr/bin/mysqladmin -u root password 'new-root-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

oppure usare la console interattiva di mysql e usare i comandi SQL

# mysql mysql 
mysql> UPDATE user SET password=PASSWORD("54321z") WHERE user='root';
mysql> flush privileges;
user anonimo e database test

All’installazione viene generato di default il database di test e lo user anonimo che dovrebbero essere eliminati in un ambiente di produzione. A qusto proposito si può utilizzare lo script

/usr/bin/mysql_secure_installation

che consente anche di impostare la password di root.

di seguto viene evidenziato lo user anonymous

mysql> select user,host FROM user;
+------+-----------------------+
| user | host                  |
+------+-----------------------+
| root | 127.0.0.1             | 
|      | localhost             | 
| root | localhost             | 
|      | localhost.localdomain | 
| root | localhost.localdomain | 
+------+-----------------------+
5 rows in set (0.00 sec)

Lo script mysql_secure_installation in azione

# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] 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? [Y/n] Y
 ... Success!

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? [Y/n] 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? [Y/n] Y
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - 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? [Y/n] 
...
...

Avviare MySQL al boot

Controllare che MySQL si avvi automaticamente al boot con

#  chkconfig --list | grep "mysqld"
mysqld         	0:off	1:off	2:off	3:off	4:off	5:off	6:off

Impostare l’avio automatico al boot con

chkconfig mysqld on

controllare il risultato con

#  chkconfig --list | grep "mysqld"
mysqld         	0:off	1:off	2:on	3:on	4:on	5:on	6:off

Output nel primo avvio di mysql con diverse utili informazioni.

[root@localhost ~]# service mysqld start
Stopping mysqld:                                           [  OK  ]
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
Advertisements
  1. Non c'è ancora nessun commento.
  1. No trackbacks yet.

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: