วันจันทร์ที่ 18 มิถุนายน พ.ศ. 2555

FreeBSD: Mysql55-Server

------------------- เริ่มเลย ------

[1] ติดตั้ง

# cd /usr/ports/databases/mysql55-server

-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ UTF8 ---------------

# make WITH_CHARSET=utf8 WITH_xCHARSET=all WITH_CALLATION=utf8_general_ci WITH_OPENSSL=yes  BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean


-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ tis620--------------

# make WITH_CHARSET=tis620 WITH_xCHARSET=all WITH_CALLATION=tis620_thai_ci WITH_OPENSSL=yes  BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean


************************************************************************

Remember to run mysql_upgrade (with the optional --datadir= flag)
the first time you start the MySQL server after an upgrade from an
earlier version.

************************** ผลการติดตั้ง ***********************************


      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/mysqld

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.mysql.com/

------------------------ ตรวจสอบผลการติดตั้ง ------------------

 -- ตรวจสอบ user ที่มีขึ้นมาใหม่

# cat /etc/passwd
mysql:*:88:88:MySQL Daemon:/var/db/mysql:/usr/sbin/nologin

 -- ตรวจสอบ Package ที่ติดตั้ง

# pkg_info |grep mysql
mysql-client-5.1.48 Multithreaded SQL database (client)
mysql-server-5.1.48 Multithreaded SQL database (server)

--------------------- Config [system] -------------
# ee /etc.rc.conf
  mysql_enable ="YES"

# cp /usr/local/share/mysql/my-large.cnf  /etc/my.cnf

#ll /etc/my.cnf
-rw-r--r--  1 root  wheel  4649 Jul 16 06:41 /etc/my.cnf

เปลี่ยน group

# chown root:sys /etc/my.cnf
# ls -l /etc/my.cnf
-rw--r--r--  1 root  sys  4757 Oct  6 21:29 /etc/my.cnf

หรือ

# chmod 644 /etc/my.cnf
# ls -l /etc/my.cnf
-rw-r--r--  1 root  sys  4757 Oct  6 21:29 /etc/my.cnf


# rehash

---------------------  Start Mysql Deamon  -------
# mysqld_safe &                                      ; To initial MySQL daemon

#/usr/local/etc/rc.d/mysql-server start        ; To start the MySQL daemon

--------------------- Monitor ---------------------

# ps waux | grep mysql       ; check process
    mysql 13771  0.0  0.6  3632  1352  ??  Is    7:32PM   0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf
    mysql 13851  0.0 18.0 188616 44204  ??  I     7:32PM   0:01.00 [mysqld]

# mysqlshow -p            ; display database
Enter password:            ; ยังไม่มี password ให้ enter ผ่าน
+--------------------+
|     Databases            |
+--------------------+
| information_schema    |
| mysql                         |
| performance_schema |
| test                            |
+--------------------+

--------- Kill process ----------------
# killall mysqld


--------------------- Config [database] -----------

# mysql_install_db --user=mysql                          ; Installing MySQL system tables.
# mysqladmin -u root password 'password'         ; To set a password for root user
# mysqladmin -u root -h  n1.name.com password 'password'

----------------------------- Test-----------------------------------
# mysql -u root -p
mysql> status;
mysql> \s
mysql> create database noomdb;
mysql> grant all privileges on noomdb.* to noom@24.0.1.122;
mysql> grant usage on noomdb.* to noom@24.0.1.122 identified by 'noomdbpassword';

====  Add user ŧ㹠mysql:user table ¾ÃéÍÁ¡Ó˹´ÊÔ·¸Ô
mysql> \? add      ;  help for add

mysql>

mysql> use mysql
mysql> select User,Password,Grant_priv from user;

+-----------+-------------------------------------------+------------+
| User          | Password                                                   | Grant_priv |
+-----------+-------------------------------------------+------------+
| root          | *85E26B8AB29FEE8453201A3511DAE24A24059109         | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
|                 |                                                                                                  | N          |
|                 |                                                                                                  | N          |
+-----------+-------------------------------------------+------------+

mysql> update user set password=password('password') where user='root';
mysql> flush privileges;
mysql> grant all on *.* to noomloveu@localhost identified by 'password';
mysql> grant all on *.* to noomloveu identified by 'password';
mysql> grant all on *.* to noomloveu@localhost;
mysql> update user set grant_priv='Y' where user='noomloveu';

 mysql> select User,Password,Grant_priv from user;

+-----------+-------------------------------------------+------------+
| User          | Password                                                   | Grant_priv |
+-----------+-------------------------------------------+------------+
| root          | *85E26B8AB29FEE8453201A3511DAE24A24059109         | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
|                 |                                                                                                  | N          |
|                 |                                                                                                  | N          |
| noomloveu | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19    |Y         |
+-----------+-------------------------------------------+------------+

ไม่มีความคิดเห็น:

แสดงความคิดเห็น