在Linux下安装MySQL的二进制源代码包(四)

2014-11-24 17:32:02 · 作者: · 浏览: 7
exists
ln: creating symbolic link `/usr/local/bin/ndb_drop_index': File exists
ln: creating symbolic link `/usr/local/bin/ndb_drop_table': File exists
ln: creating symbolic link `/usr/local/bin/ndb_error_reporter': File exists
ln: creating symbolic link `/usr/local/bin/ndb_mgm': File exists
ln: creating symbolic link `/usr/local/bin/ndb_mgmd': File exists
ln: creating symbolic link `/usr/local/bin/ndb_restore': File exists
ln: creating symbolic link `/usr/local/bin/ndb_select_all': File exists
ln: creating symbolic link `/usr/local/bin/ndb_select_count': File exists
ln: creating symbolic link `/usr/local/bin/ndb_show_tables': File exists
ln: creating symbolic link `/usr/local/bin/ndb_size.pl': File exists
ln: creating symbolic link `/usr/local/bin/ndb_test_platform': File exists
ln: creating symbolic link `/usr/local/bin/ndb_waiter': File exists
ln: creating symbolic link `/usr/local/bin/perror': File exists
ln: creating symbolic link `/usr/local/bin/replace': File exists
ln: creating symbolic link `/usr/local/bin/resolveip': File exists
ln: creating symbolic link `/usr/local/bin/resolve_stack_dump': File exists
ln: creating symbolic link `/usr/local/bin/safe_mysqld': File exists
9.启动mysql_safe,如下:
[root@localhost local]# bin/mysqld_safe --user=mysql --socket=/tmp/mysql.sock --port=3306 &
[1] 26860
[root@localhost local]# nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /usr/local/mysql/data
查看一下 3308 端口是否已经在监听:
netstat -anp|grep LISTEN
10.添加到系统自启动,如下:
[root@localhost local]# cp mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@localhost local]# chkconfig --add mysqld
11.启动mysql服务进程,如下:
[root@localhost local]# /etc/init.d/mysqld start
Starting MySQL [ OK ]
12.给 root 指定密码为"python",host为localhost ,如下:
[root@localhost local]# bin/mysqladmin --socket=/tmp/mysql.sock --port=3306 -u root -h localhost password 'python'
13.登录root,并给root授权!如下所示:
[root@localhost local]# bin/mysql --port=3306 -u root -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.51a MySQL Community Server (GPL)


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


mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'python';
Query OK, 0 rows affected (0.54 sec)#[给使用localhost连接的root用户以所有权限]


mysql>flush privileges;
Query OK, 0 rows affected (0.26 sec)#[刷新用户权限列表,更新权限]
mysql> quit
Bye
14.新建一个用户,如下:
//登录MYSQL
[root@localhost local]# bin/mysql --port=3306 -u root -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.51a MySQL Community Server (GPL)


Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
//使用mysql数据库
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> insert into mysql.user(Host,User,Password) values("localhost","django",password("django"));
Query OK, 1 row affected, 3 warnings (0.60 sec)
//刷新系统权限表
mysql> flush privileges;
Query OK, 0 rows affected (0.08 sec)
这样就创建了一个名为:django 密码为:django 的用户。
//然后登录一下
mysql> exit;
Bye
[root@localhost local]# bin/mysql --port=3306 -u django -p -S /tmp/mysql.sock
Enter password: //输入 码
Welcome to the MySQL monitor. Commands end with ;