CentOS 에서 MySQL 설치 및 시작 하기
[root@localhost ~]# yum -y install mysql mysql-server mysql-connector-odbc mysql-develLoaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.khlug.org
* extras: mirror.khlug.org
* updates: mirror.khlug.org
Setting up Install Process
Package mysql-5.0.77-4.el5_6.6.i386 already installed and latest version
Package mysql-server-5.0.77-4.el5_6.6.i386 already installed and latest version
Package mysql-connector-odbc-3.51.26r1127-1.el5.i386 already installed and latest version
Package mysql-devel-5.0.77-4.el5_6.6.i386 already installed and latest version
Nothing to do // 이미 설치 되어 있는 경우[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf’? y
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cp /etc/my.cnf /etc/my.cnf.org
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vi /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
#인코딩 설정default-character-set=utf8
[root@localhost ~]# /etc/rc.d/init.d/mysqld start
MySQL 데이타베이스를 초기화하는 중: Installing MySQL system tables…
080127 2:09:42 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to 4294967295
080127 2:09:42 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables…
080127 2:09:43 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to 4294967295
080127 2:09:43 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to 4294967295
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 ]
MySQL (을)를 시작 중: [ OK ]
[root@localhost ~]# mysql -u rootWelcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77-log Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
mysql>
mysql>
mysql> use mysql
Database changed
mysql>
mysql>
mysql>
mysql> show variables like ‘c%’;
+————————–+—————————-+
| Variable_name | Value |
+————————–+—————————-+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 10 |
+————————–+—————————-+
14 rows in set (0.00 sec)
mysql>
mysql> use mysql
Database changed
mysql> update user set password=password(*****) where user=’root’;Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql> use mysql
Database changed
mysql> select host, user, password from user;+———————–+——+——————————————-+
| host | user | password |
+———————–+——+——————————————-+
| localhost | root | *B24C5B1413F57C9A613ABF4429CF4EA1E2250750 |
| localhost.localdomain | root | *B24C5B1413F57C9A613ABF4429CF4EA1E2250750 |
| 127.0.0.1 | root | *B24C5B1413F57C9A613ABF4429CF4EA1E2250750 |
| localhost | | |
| localhost.localdomain | | |
+———————–+——+——————————————-+
5 rows in set (0.00 sec)
mysql>
mysql>
mysql> grant all on cafe.* to coozplz@’%’ identified by ‘********’;Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql> select host, user, password from user;
+———————–+——+——————————————-+
| host | user | password |
+———————–+——+——————————————-+
| localhost | root | *B24C5B1413F57C9A613ABF4429CF4EA1E2250750 |
| localhost.localdomain | root | *B24C5B1413F57C9A613ABF4429CF4EA1E2250750 |
| 127.0.0.1 | root | *B24C5B1413F57C9A613ABF4429CF4EA1E2250750 |
| localhost | | |
| localhost.localdomain | | |
| % | cafe | *B24C5B1413F57C9A613ABF4429CF4EA1E2250750 | +———————–+——+——————————————-+
6 rows in set (0.00 sec)
mysql>
mysql>
mysql>