Install
Install the
MySql package when you install
CentOS or
Red Hat RHEL (Extras)
Debian, Ubuntu or Xubuntu
Run Synaptic and choose the mysql package
Secure
Initially there are two
MySql 'root' accounts (not the same as your *nix root) and two Anonymous accounts
You will probably want to set passwords on the 'root' accounts and delete the anonymous accounts
# service mysqld start
# mysql -u root
mysql> use mysql
mysql> select user,host,password from user;
| user | host | password |
| root | localhost | |
| root | localhost.localdomain | |
| | localhost | |
| | localhost.localdomain | |
4 rows in set (0.01 sec)
mysql> quit
MySQL Initialise Passwords
# mysqladmin -u root password "mypassword"
# mysqladmin -u root -h <localhost.localdomain> password "mypassword"
Now that you've set a password you'll need to use it EVERY time !
MySQL Initialise Anonymous Passwords
# mysql -u root -p
Enter password:
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('mypassword');
mysql> SET PASSWORD FOR ''@'<localhost.localdomain>' = PASSWORD('mypassword');
mysql> quit
MySQL Delete Anonymous Accounts
# mysql -u root -p
Enter password:
mysql> use mysql
mysql> DELETE FROM mysql.user WHERE User = '';
mysql> FLUSH PRIVILEGES;
mysql> quit
MySQL verify that root has passwords and anaonymous accounts have been deleted
# mysql -u root -p
Enter password:
mysql> use mysql
mysql> select user,host,password from user;
| user | host | password |
| root | localhost | **************** |
| root | localhost.localdomain | **************** |
2 rows in set (0.01 sec)
mysql> quit
By default
MySQL 5 is only bound to listen to and only accept requests from localhost 127.0.0.1
If you want to connect from a separate pc/server
# vi /etc/mysql/my.cnf
bind-address = 127.0.0.1 change to <your.ip.addr>
REFERRERS
MySql
There are no comments on this page. [Add comment]