본문 바로가기
dev, tech/solaris

솔라리스(Solaris) 10 : 내장된 Mysql 설정(활성화)하기

by 구띵 2009. 11. 10.

 

중요!!! 아래는 솔라리스10에 포함된 mysql을 그대로 사용할 경우입니다. (버전 4.x.x)

 

1. root로 로그인한다.

 

2. 프로프트에서 다음 명령어로 솔라리스에 내장된 mysql활성화 순서를 보도록 한다.

 

#> cat /etc/sfw/mysql/README.solaris.mysql

 

(아래는 cat명령어로 쏟아지는 내용이다)

 

To use mysql a number of post-install procedures need to be made by root.

The following steps are derived from the mysql manual (manual.ps, manual.txt or
manual_toc.html) found in the /usr/sfw/src/mysql/Docs directory.

Initialise the database tables.

# /usr/sfw/bin/mysql_install_db

Create mysql user and group and change data directory group.

# groupadd mysql
# useradd -g mysql mysql
# chgrp -R mysql /var/mysql
# chmod -R 770
# installf SUNWmysqlr /var/mysql d 770 root mysql

MySQL reads configuration files from different places in the following order.

Filename Purpose
--------- ---------
/etc/my.cnf Global options

DATADIR/my.cnf Server-specific options

To use mysql a number of post-install procedures need to be made by root.

The following steps are derived from the mysql manual (manual.ps, manual.txt or
manual_toc.html) found in the /usr/sfw/src/mysql/Docs directory.

Initialise the database tables.

# /usr/sfw/bin/mysql_install_db

Create mysql user and group and change data directory group.

# groupadd mysql
# useradd -g mysql mysql
# chgrp -R mysql /var/mysql
# chmod -R 770
# installf SUNWmysqlr /var/mysql d 770 root mysql

MySQL reads configuration files from different places in the following order.

Filename Purpose
--------- ---------
/etc/my.cnf Global options

DATADIR/my.cnf Server-specific options

defaults-extra-file The file specified with
--defaults-extra-file=path

~/.my.cnf User-specific options

Optionally copy a mysql daemon configuration file to configuration directory.
Note there are other configuration profiles available.
For default solaris installation DATADIR is /var/mysql.

# cp /usr/sfw/share/mysql/my-medium.cnf /var/mysql/my.cnf

Start mysql daemon by hand
# /usr/sfw/sbin/mysqld_safe --user=mysql &

Optionally perform the following steps for automatic start and stop of
mysql daemon at boot and shutdown.

Link boot time start up script from rc3.d and rc[012S].d
# ln /etc/sfw/mysql/mysql.server /etc/rc3.d/S99mysql
# ln /etc/sfw/mysql/mysql.server /etc/rc0.d/K00mysql
# ln /etc/sfw/mysql/mysql.server /etc/rc1.d/K00mysql
# ln /etc/sfw/mysql/mysql.server /etc/rc2.d/K00mysql
# ln /etc/sfw/mysql/mysql.server /etc/rcS.d/K00mysql

 

3. 위에 보이는 순서대로 잘 따라한다. ^^

(주의) 계정에 대한 패스워드를 꼭 설정(mysqladmin를 통해)해주세요~ 무턱대고 하다보면 mysql 모니터에 접근을 못합니다.

 

 

---------------------------------------------------------

다음은 실제화면을 캡쳐한 것입니다.

충분히 조금씩 다른 메시지가 나타날수 있으니 참고하세요.

 

bash-3.00# /usr/sfw/bin/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
091110 16:45:30 /usr/sfw/sbin/mysqld: Shutdown Complete

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/sfw/bin/mysqladmin -u root password 'new-password'
/usr/sfw/bin/mysqladmin -u root -h groupname password 'new-password'
See the manual for more instructions.

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

You can test the MySQL daemon with the tests in the 'mysql-test' directory:
cd /usr/sfw/mysql/mysql-test; ./mysql-test-run

Please report any problems with the /usr/sfw/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

 

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

bash-3.00# /usr/sfw/bin/mysqladmin -u root password 'new-password'
bash-3.00#
/usr/sfw/bin/mysqladmin -u root -h groupname password 'new-password'

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

bash-3.00# /usr/sfw/sbin/mysqld_safe --user=mysql &
[1] 5096
bash-3.00# Starting mysqld daemon with databases from /var/mysql
STOPPING server from pid file /var/mysql/name.pid
091110 16:50:46  mysqld ended


[1]+  Done                    /usr/sfw/sbin/mysqld_safe --user=mysql

 

 

* 다음과 같은 에러발생시 (root계정으로 mysql monitor 접근이 안될 때에는) 다음 링크를 참고하여 해결하도록 한다.

error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

 

http://kin.naver.com/detail/detail.php?d1id=1&dir_id=10202&docid=7996142&qb=L3Vzci9zZncvYmluL215c3FsYWRtaW46IGNvbm5lY3QgdG8gc2VydmVyIGF0ICdsb2NhbGhvc3QnIGZhaWxlZA==&enc=utf8&section=kin&rank=3&sort=0&spq=0&pid=fYCEIB331y8ssaucBRKssv--334510&sid=SvjjpvzY@EoAADy-D5E

 

(다음에서 보는 것처럼 중복테이블이 존재해서 접근이 불가능한 경우가 있다)

bash-3.00# /usr/sfw/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.0.31-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Database changed
mysql> select host, user, password from user;
+-----------+------+------------------+
| host      | user | password         |
+-----------+------+------------------+
| localhost | root | 5f8e078f7d27a9e9 |
| acaa   | root |                  |
| localhost |      |                  |
| acaa   |      |                  |
+-----------+------+------------------+
4 rows in set (0.02 sec)

 

bash-3.00# /usr/sfw/sbin/mysqld stop 데몬 종료

 

댓글