mysql基本操作

lawzjf發表於2008-01-18

[mysql@redhat ~]$ cat .my.cnf
[mysql]
user=root
password=root
[mysqld]
datadir=/mysql/mysql-5.0.41-linux-i686/data
[mysql@redhat ~]$ cd /mysql/mysql-5.0.41-linux-i686
[mysql@redhat mysql-5.0.41-linux-i686]$ cd bin
[mysql@redhat bin]$ ./mysqld_safe &
[1] 3316
[mysql@redhat bin]$ Starting mysqld daemon with databases from /mysql/mysql-5.0.41-linux-i686/data
logout
[root@redhat bin]# su - mysql

Good Luck!!


[mysql@redhat ~]$ cd /mysql/mysql-5.0.41-linux-i686/bin
[mysql@redhat bin]$ ./mysqladmin -uroot -proot shutdown
STOPPING server from pid file /var/run/mysqld/mysqld.pid
080118 22:10:49  mysqld ended

[mysql@redhat bin]$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[mysql@redhat bin]$ ./mysql_safe &
[1] 3391
-bash: ./mysql_safe: No such file or directory
[mysql@redhat bin]$ ./mysqld_safe &
[2] 3392
[1]   Exit 127                ./mysql_safe
[mysql@redhat bin]$ Starting mysqld daemon with databases from /mysql/mysql-5.0.41-linux-i686/data

[mysql@redhat bin]$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.41

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

mysql> show databases
    -> ;
+----------------------------+
| Database                    |
+----------------------------+
| information_schema |
| law                                |
| mysql                           |
| test                               |
| testdatadir                  |
+----------------------------+
5 rows in set (0.06 sec)

mysql> use law
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_law |
+--------------------+
| t                          |
| tt                         |
+--------------------+
2 rows in set (0.01 sec)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/37724/viewspace-152667/,如需轉載,請註明出處,否則將追究法律責任。

相關文章