2.8 MySQL
2.8.1 编译安装MySQL
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql \
--datadir=/usr/local/mysql/data \
--with-charset=gbk \
--localstatedir=/usr/local/mysql/data \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
shell> make
shell> make install
#cd /usr/local/mysql
#bin/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql data
#chgrp -R mysql .
#bin/mysqld_safe --user=mysql &
shell> /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
2.8.2 MySQL安装后步骤
[root@ mysql]# /usr/local/mysql/bin/mysqladmin -u root password 'redroot'
[root@ mysql]# cd bin
[root@ bin]# ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.67-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> DELETE FROM mysql.user WHERE User = '';
Query OK, 2 rows affected (0.00 sec)
mysql> UPDATE mysql.user SET Password = PASSWORD('redroot') WHERE User = 'root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> SELECT Host, User FROM mysql.user;
+-----------------+------+
| Host | User |
+-----------------+------+
| 127.0.0.1 | root |
| JLDJ-SPT-ICS-TV | root |
| localhost | root |
+-----------------+------+
3 rows in set (0.00 sec)
mysql> insert into mysql.user(Host, User) values('%', 'root');
Query OK, 1 row affected, 3 warnings (0.00 sec)
mysql> SELECT Host, User FROM mysql.user;
+-----------------+------+
| Host | User |
+-----------------+------+
| % | root |
| 127.0.0.1 | root |
| JLDJ-SPT-ICS-TV | root |
| localhost | root |
+-----------------+------+
4 rows in set (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR = PASSWORD('redroot');
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON *.* TO ;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
阅读(1572) | 评论(0) | 转发(0) |