安装成功了,启动时却出现The program 'mysql' can be found in the following packages: * mysql-client-5.1 * mysql-client-5.0 Try: apt-get install <selected package>
到mysql的bin目录下运行里面的mysql.
我就是在这个目录下运行的呀root@ubuntu:/usr/local/mysql/bin# mysql start The program 'mysql' can be found in the following packages: * mysql-client-5.1 * mysql-client-5.0 Try: apt-get install <selected package> mysql: command not found
如果在此目录下输入会这样root@ubuntu:/usr/local/mysql# bin/mysql start ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
直接mysql -u root啊
也是一样啊 root@ubuntu:/usr/local/mysql/bin# mysql -u root The program 'mysql' can be found in the following packages: * mysql-client-5.1 * mysql-client-5.0 Try: apt-get install <selected package> mysql: command not found root@ubuntu:/usr/local/mysql/bin# cd /usr/local/mysql/ root@ubuntu:/usr/local/mysql# bin/mysql -u root ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) root@ubuntu:/usr/local/mysql#
apt-get install mysql-client-5.1
为啥要装客户端,server自己难道不能启动?
另外我查了一下,可以这样ln -s /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 不过我 /var/lib/mysql/文件夹下却没有mysql.sock root@ubuntu:/var/lib/mysql# ls ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema test ubuntu.err
mysql这个命令是客户端程序,不是服务器端程序。 服务器启动的进程是mysqld.
你装完mysql以后 service mysql start | stop 就可以启动mysql了。最好看看mysql的官方手册,了解一下linux下边mysql的基本使用。
这个也试过了 root@ubuntu:/usr/bin# service mysql start mysql: unrecognized service
root@ubuntu:/usr/local/mysql# /usr/local/mysql/bin/mysqld_safe --user=mysql & [1] 3219 root@ubuntu:/usr/local/mysql# 110105 21:59:12 mysqld_safe Logging to '/var/lib/mysql/ubuntu.err'. 110105 21:59:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 110105 21:59:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 我用mysqld_safe启动,2秒后就ended了
er g++ -o"TestCpp" ./src/TestCpp.o Finished building target: TestCpp
110105 21:59:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 110105 21:59:13 [ERROR] Can't find messagefile '/usr/share/errmsg.sys' 110105 21:59:13 [Note] Plugin 'FEDERATED' is disabled. InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use InnoDB's own implementation InnoDB: Compressed tables use zlib 1.2.3 110105 21:59:13 InnoDB: Using Linux native AIO 110105 21:59:13 InnoDB: Initializing buffer pool, size = 128.0M 110105 21:59:13 InnoDB: Completed initialization of buffer pool 110105 21:59:13 InnoDB: highest supported file format is Barracuda. 110105 21:59:14 InnoDB: 1.1.4 started; log sequence number 1595675 110105 21:59:14 [ERROR] Aborting110105 21:59:14 InnoDB: Starting shutdown... 110105 21:59:15 InnoDB: Shutdown completed; log sequence number 1595675 110105 21:59:15 [Note] 110105 21:59:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
然后再装。
* mysql-client-5.1
* mysql-client-5.0
Try: apt-get install <selected package>
The program 'mysql' can be found in the following packages:
* mysql-client-5.1
* mysql-client-5.0
Try: apt-get install <selected package>
mysql: command not found
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
直接mysql -u root啊
root@ubuntu:/usr/local/mysql/bin# mysql -u root
The program 'mysql' can be found in the following packages:
* mysql-client-5.1
* mysql-client-5.0
Try: apt-get install <selected package>
mysql: command not found
root@ubuntu:/usr/local/mysql/bin# cd /usr/local/mysql/
root@ubuntu:/usr/local/mysql# bin/mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root@ubuntu:/usr/local/mysql#
不过我 /var/lib/mysql/文件夹下却没有mysql.sock
root@ubuntu:/var/lib/mysql# ls
ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema test ubuntu.err
服务器启动的进程是mysqld.
service mysql start | stop
就可以启动mysql了。最好看看mysql的官方手册,了解一下linux下边mysql的基本使用。
root@ubuntu:/usr/bin# service mysql start
mysql: unrecognized service
[1] 3219
root@ubuntu:/usr/local/mysql# 110105 21:59:12 mysqld_safe Logging to '/var/lib/mysql/ubuntu.err'.
110105 21:59:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110105 21:59:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
我用mysqld_safe启动,2秒后就ended了
g++ -o"TestCpp" ./src/TestCpp.o
Finished building target: TestCpp
110105 21:59:13 [ERROR] Can't find messagefile '/usr/share/errmsg.sys'
110105 21:59:13 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
110105 21:59:13 InnoDB: Using Linux native AIO
110105 21:59:13 InnoDB: Initializing buffer pool, size = 128.0M
110105 21:59:13 InnoDB: Completed initialization of buffer pool
110105 21:59:13 InnoDB: highest supported file format is Barracuda.
110105 21:59:14 InnoDB: 1.1.4 started; log sequence number 1595675
110105 21:59:14 [ERROR] Aborting110105 21:59:14 InnoDB: Starting shutdown...
110105 21:59:15 InnoDB: Shutdown completed; log sequence number 1595675
110105 21:59:15 [Note]
110105 21:59:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended