Saminnet-Search Article Wiki Forum Piwigo SNS Cloud vtiger Sugar
MySQL Install

MySQL Install

笆MySQL繧、繝ウ繧ケ繝医シ繝ォ

[root@centos ~]# yum -y install mysql-server縲竊舌mysql-server繧、繝ウ繧ケ繝医シ繝ォ

笆MySQL險ュ螳

[root@centos ~]# vi /etc/my.cnf縲竊舌MySQL險ュ螳壹ヵ繧。繧、繝ォ邱ィ髮
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8縲竊舌霑ス蜉(MySQL繧オ繝シ繝舌シ縺ョ譁蟄励さ繝シ繝峨rUTF-8縺ォ縺吶k)

笆MySQL襍キ蜍

[root@centos ~]# /etc/rc.d/init.d/mysqld start縲竊舌MySQL襍キ蜍
MySQL 繝繝シ繧ソ繝吶シ繧ケ繧貞晄悄蛹紋クュ:  Installing MySQL system tables...
OK
Filling help tables...
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 centos.centossrv.com 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 /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
mysqld 繧定オキ蜍穂クュ:                                           [  OK  ]

[root@centos ~]# chkconfig mysqld on縲竊舌MySQL閾ェ蜍戊オキ蜍戊ィュ螳

笆MySQL蛻晄悄險ュ螳

[root@centos ~]# mysql_secure_installation縲竊舌MySQL蛻晄悄險ュ螳




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 縲竊舌遨コENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] 縲竊舌遨コENTER(root繝代せ繝ッ繝シ繝芽ィュ螳)
New password: 縲竊舌root繝代せ繝ッ繝シ繝牙ソ懃ュ
Re-enter new password: 縲竊舌root繝代せ繝ッ繝シ繝牙ソ懃ュ(遒コ隱)
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 縲竊舌遨コENTER(蛹ソ蜷阪Θ繝シ繧カ繝シ蜑企勁)
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 縲竊舌遨コENTER(繝ェ繝「繝シ繝医°繧峨ョroot繝ュ繧ー繧、繝ウ遖∵ュ「)
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 縲竊舌遨コENTER(test繝繝シ繧ソ繝吶シ繧ケ蜑企勁)
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 縲竊舌遨コENTER
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

笆MySQL遒コ隱

[root@centos ~]# mysql -u root -p縲竊舌MySQL縺クroot縺ァ繝ュ繧ー繧、繝ウ
Enter password: 縲竊舌MySQL縺ョroot繝代せ繝ッ繝シ繝牙ソ懃ュ
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 4.1.12

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


mysql> grant all privileges on test.* to centos@localhost identified by 'centospass';
縲竊舌test繝繝シ繧ソ繝吶シ繧ケ縺ク縺ョ蜈ィ縺ヲ縺ョ繧「繧ッ繧サ繧ケ讓ゥ髯舌r謖√▲縺溘∵眠隕上Θ繝シ繧カcentos繧堤匳骭イ
Query OK, 0 rows affected (0.00 sec)

mysql> select user from mysql.user where user='centos';縲竊舌centos繝ヲ繝シ繧カ逋サ骭イ遒コ隱
+--------+
| user   |
+--------+
| centos |
+--------+
1 row in set (0.00 sec)

mysql> exit縲竊舌繝ュ繧ー繧「繧ヲ繝
Bye

[root@centos ~]# mysql -u centos -pcentospass縲竊舌centos繝ヲ繝シ繧カ縺ァMySQL繧オ繝シ繝舌シ縺ク繝ュ繧ー繧、繝ウ
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 4.1.12

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

mysql> create database test;縲竊舌test繝繝シ繧ソ繝吶シ繧ケ菴懈
Query OK, 1 row affected (0.00 sec)

mysql> show databases;縲竊舌繝繝シ繧ソ繝吶シ繧ケ菴懈千「コ隱
+----------+
| Database |
+----------+
| mysql    |
| test     |
+----------+
2 rows in set (0.01 sec)

mysql> use test縲竊舌test繝繝シ繧ソ繝吶シ繧ケ縺ク謗・邯
Database changed

mysql> create table test(num int, name varchar(50));縲竊舌test繝繝シ繝悶Ν菴懈
Query OK, 0 rows affected (0.01 sec)

mysql> show tables;縲竊舌繝繝シ繝悶Ν菴懈千「コ隱
+----------------+
| Tables_in_test |
+----------------+
| test           |
+----------------+
1 row in set (0.00 sec)

mysql> insert into test values(1,'螻ア逕ー螟ェ驛');縲竊舌test繝繝シ繝悶Ν縺ク繝繝シ繧ソ逋サ骭イ
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;縲竊舌繝繝シ繧ソ逋サ骭イ遒コ隱
+------+----------+
| num  | name     |
+------+----------+
|    1 | 螻ア逕ー螟ェ驛 |
+------+----------+
1 row in set (0.00 sec)

mysql> update test set name='螻ア逕ー谺。驛';縲竊舌test繝繝シ繝悶Ν蜀繝繝シ繧ソ譖エ譁ー
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from test;縲竊舌繝繝シ繧ソ譖エ譁ー遒コ隱
+------+----------+
| num  | name     |
+------+----------+
|    1 | 螻ア逕ー谺。驛 |
+------+----------+
1 row in set (0.01 sec)

mysql> delete from test where num=1;縲竊舌test繝繝シ繝悶Ν蜀繝繝シ繧ソ蜑企勁
Query OK, 1 row affected (0.03 sec)

mysql> select * from test;縲竊舌繝繝シ繧ソ蜑企勁遒コ隱
Empty set (0.00 sec)

mysql> drop table test;縲竊舌test繝繝シ繝悶Ν蜑企勁
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;縲竊舌繝繝シ繝悶Ν蜑企勁遒コ隱
Empty set (0.00 sec)

mysql> drop database test;縲竊舌繝繝シ繧ソ繝吶シ繧ケtest蜑企勁
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;縲竊舌繝繝シ繧ソ繝吶シ繧ケ蜑企勁遒コ隱
+----------+
| Database |
+----------+
| mysql    |
+----------+
1 row in set (0.00 sec)

mysql> exit縲竊舌繝ュ繧ー繧「繧ヲ繝
Bye

[root@centos ~]# mysql -u root -p縲竊舌MySQL縺クroot縺ァ繝ュ繧ー繧、繝ウ
Enter password: 縲竊舌MySQL縺ョroot繝代せ繝ッ繝シ繝牙ソ懃ュ
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21 to server version: 4.1.12

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

mysql> revoke all privileges on *.* from centos@localhost;縲竊舌centos繝ヲ繝シ繧カ縺九i蜈ィ縺ヲ縺ョ繝繝シ繧ソ繝吶シ繧ケ縺ク縺ョ繧「繧ッ繧サ繧ケ讓ゥ髯舌r蜑・螂ェ
Query OK, 0 rows affected (0.00 sec)

mysql> delete from mysql.user where user='centos' and host='localhost';縲竊舌centos繝ヲ繝シ繧カ蜑企勁
Query OK, 1 row affected (0.01 sec)

mysql> select user from mysql.user where user='centos';縲竊舌centos繝ヲ繝シ繧カ蜑企勁遒コ隱
Empty set (0.00 sec)

mysql> flush privileges;縲竊舌centos繝ヲ繝シ繧カ縺ョ蜑企勁繧樽ySQL繧オ繝シ繝舌シ縺ク蜿肴丐
Query OK, 0 rows affected (0.01 sec)

mysql> exit縲竊舌繝ュ繧ー繧「繧ヲ繝
Bye

Comments   

 
0 #1 Guest 2016-09-30 15:11
_____
_________________
___________
____
______WEB_________________FX_____
_______________
______________________________

Here is my homepage ____________
Quote
 

Category Database

TweetTweet Share on LinkedInShare on LinkedIn Share on Google+Google+ Submit to RedditReddit Publish on WordPress WordPress Send emailSend email