database/mysql

[mysql] 우분투 mysql 설치 후 셋팅

labj 2013. 10. 28. 17:48

[mysql] 우분투 mysql 설치 후 셋팅

 

mysql 환경설정파일 :/etc/my.cnf


[root@nmpweb01 /]# find . -name mysqld
./etc/rc.d/init.d/mysqld
./etc/logrotate.d/mysqld
./usr/libexec/mysqld
./var/run/mysqld
./var/lock/subsys/mysqld
[root@nmpweb01 /]# find . -name mysql
./usr/bin/mysql
./usr/lib64/mysql
./usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql
./usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql
./usr/lib/mysql
./usr/include/mysql
./usr/share/mysql
./var/lib/mysql
./var/lib/mysql/mysql
[root@nmpweb01 /]# cd /usr/bin
[root@nmpweb01 bin]#
[root@nmpweb01 bin]#
[root@nmpweb01 bin]# killall mysqld
[root@nmpweb01 bin]# mysqld_safe --skip-grant &
[1] 28564
[root@nmpweb01 bin]# Starting mysqld daemon with databases from /var/lib/mysql

[root@nmpweb01 bin]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| gamekok            |
| gmile              |
| mysql              |
| test               |
| zipcode_manage     |
+--------------------+
6 rows in set (0.01 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> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| func                      |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| proc                      |
| procs_priv                |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
17 rows in set (0.00 sec)

mysql>

[root@nmpweb01 bin]# ps -ef | grep mysqld
root     28780     1  0 17:20 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql    28862 28780  0 17:20 ?        00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --log-error=/var/log/mysqld.log --socket=/var/lib/mysql/mysql.sock
root     28913 27780  0 17:22 pts/1    00:00:00 grep mysqld
[root@nmpweb01 bin]# kill 28862
[root@nmpweb01 bin]#
[root@nmpweb01 bin]# ./mysqld_safe --user=mysql --skip-grant-tables &
[1] 28933
[root@nmpweb01 bin]# Starting mysqld daemon with databases from /var/lib/mysql

[root@nmpweb01 bin]#
[root@nmpweb01 bin]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 53
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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> update user set password=password('password') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 4  Changed: 3  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit!
Aborted
[root@nmpweb01 bin]#

[root@nmpweb01 bin]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all privileges on *.* to 'gmile'@'localhost' identified by 'password' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'gmile'@'%' identified by 'password' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>

 

[mysql] 우분투 mysql 설치 후 셋팅