10
Res
11
Res
12
INSTALL PhpMyAdmin + Usage
- install repoforge repository
- yum install phpmyadmin php-mcrypt
- edit phpmyadmin.conf in
/etc/httpd/conf.d
<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
Allow from all
</Directory>
- [root@rdesk conf.d]# nano -w
/usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = 'your_own_secret';
$cfg['Servers'][$i]['auth_type'] =
'http'; <<< from cookie change
to http if necessary
- usage as following:
MySQL > db > Browse >
Insert
host = localhost
db = name_db
user = shell user for that db
click YES for the top six option .. from select_priv until
drop_priv
and another one.. the bottom one .. alter_priv
save
MySQL > user > Browse
> Insert
host = localhost
user = shell user
password = password_for_the_user <select password
field>
save
Home > "create the db ( name_db ) or for the particular
user u just create"
Reload MySQL
13
Redirect Script - save as
index.php
- <?php
header
('Location:http://unixman.noc.net.my/src/manual_contents.html');
?>
15
PHP - INFO
- In the shell
DocumentRoot $ echo '<?php phpinfo ();
?>' > info.php
16
CHMOD CHILDREN FOLLOW PARENT ( Use
With Care )
17
CHMOD file with chmod.php
- <?php
chmod ("configure.php", 644);
?>
18
CHMOD WRITEABLE
19
PHP Security
- edit php.ini to make off "expose_php =
Off"
20
PHP Security Audit
- http://phpsec.org/projects/phpsecinfo/
21
Security - NO.1 /etc/my.cnf
- [mysqld]
bind-address=127.0.0.1
22
Security - NO.2 : Change MySQL
root User
23
MySQL Create User / db / tables
- mysql> GRANT ALL PRIVILEGES
ON noc_db.*
->
TO 'noc'@'localhost'
-> IDENTIFIED
BY
'nocpass' WITH GRANT OPTION;
mysql> create database noc_db;
mysql> FLUSH PRIVILEGES;
mysql> use mysql;
mysql> select User
from mysql.user;
+------+
| User |
+------+
| root |
---------------------
root@sol-11dev:/home/noc/www/phpmyadmin/examples#
mysql <
create_tables.sql
24
GRANT ALL TO ROOT #Security ISSUE!!
- GRANT ALL PRIVILEGES
ON *.* TO 'root'@'%'IDENTIFIED BY ''
WITH GRANT OPTION;
25
MySQL Change root Password
- mysql> use mysql;
mysql> update user
set password=PASSWORD("new-root-pass") where
User='root';
mysql> flush
privileges;
mysql> quit
26
MySQL Reset Password
- # mysqld_safe --skip-grant-tables &
- # mysql -u root
27
Proven Scaling MySQL Enterprise
12
MySQL Proxy From Laptop . see more at SECURE
TUNNEL
- ssh -f -L 3001:localhost:3306 root@nocnet -p 8022 sleep
2d
- run mysqladministrator port 3001
28
MySQL Clean Up ( WARNING=BEFORE MYSQL IS USED )
- Please Clean Up MySQL default
installation
[root@sme ~]# mysql -u
root -p
Enter password:
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c'
to clear the buffer.
mysql> drop database
test;
Query OK, 0 rows affected (0.02 sec)
mysql> use mysql;
Reading table information for completion of table and
column names
You can turn off this feature to get a quicker startup
with -A
Database changed
mysql> delete from
db;
Query OK, 2 rows affected (0.00 sec)
mysql> delete from
user where not (host="localhost" and user="root");
Query OK, 3 rows affected (0.02 sec)
mysql> flush
privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
29
MY-Backup Database
- [root@invt-svr
smf]# mysqldump
--all-databases --lock-tables=0 -uroot -B | bzip2
> /home/rou/all-database-invt-svr-20140612.bz2
30
MY-NOC