Ubuntu 9.10下安装配置mysql 6.0.10

 

安装到usr/local/mysql中


解压文件


释放后将名称改为mysql


复制此文件夹到usr/local下


sudo chmod -R 777 mysql


sudo cp /usr/local/mysql/surport-file/my-small.cnf     /etc/my.cnf

注意下面的操作 命令执行的位置很重要,不然会说找不到


cd /usr/local/mysql


此时因为还没有初始化数据库, 直接 ./bin/mysqld 是成功不了的,你可以试试

pwd 显示
/usr/local/mysql                (注意此时必须在这个目录下)
然后


scripts/mysql_install_db


出现:

 

eric-desktop mysql # scripts/mysql_install_db
chown: invalid user: `mysql'
chown: invalid user: `mysql'
chown: invalid user: `mysql'



Installing MySQL system tables...
100721 15:17:56 [ERROR] Fatal error: Can't change to run as user 'mysql' ;  Please check that the user exists!

100721 15:17:56 [ERROR] Aborting

100721 15:17:56 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=0
read_buffer_size=262144
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 49325 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = (nil) thread_stack 0x30000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x2d) [0x86f53fd]
/usr/local/mysql/bin/mysqld(handle_segfault+0x39f) [0x8265ddf]
[0xcd8400]
/usr/local/mysql/bin/mysqld [0x8264f74]
/usr/local/mysql/bin/mysqld(unireg_abort+0x30) [0x8267690]
/usr/local/mysql/bin/mysqld(main+0xac6) [0x826bad6]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x674b56]
/usr/local/mysql/bin/mysqld(__fxstat64+0xad) [0x819b5a1]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

Installation of system tables failed!  Examine the logs in
/home/oem/Data for more information.

You can try to start the mysqld daemon with:

    shell> /usr/local/mysql/bin/mysqld --skip-grant &

and use the command line tool /usr/local/mysql/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/local/mysql/bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /home/oem/Data that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com/.  Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us!  And remember, if
you do mail us, you MUST use the /usr/local/mysql/scripts/mysqlbug script!

 

 

 

说用户“mysql”不合法,于是,打开/etc/mysql/my.cnf 修改如下:

 

user        = root
pid-file    = /var/run/mysqld/mysqld.pid
socket        = /var/run/mysqld/mysqld.sock
port        = 3306
basedir        = /usr/local/mysql
datadir        = /home/oem/Data
tmpdir        = /tmp
skip-external-locking

 

 

然后到/usr/mysql/目录下,再次:scripts/mysql_install_db

 

Installing MySQL system tables...
100721 15:26:15 [Note] Falcon: unable to open system data files.
100721 15:26:15 [Note] Falcon: creating new system data files.
100721 15:26:18 [Warning] Forcing shutdown of 2 plugins
OK
Filling help tables...
100721 15:26:21 [Warning] Forcing shutdown of 2 plugins
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/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h eric-desktop password 'new-password'

Alternatively you can run:
/usr/local/mysql/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/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
 

接下来设置开机自启动 以及 帐户密码

 

将文件mysql.server复制到/etc/init.d/mysql目录下,并设置相应权限。使用chkconfig命令将其加入到开机启动。(Ubuntu9.10没有chkconfig,需要自己sudo apt-get install chkconfig安装),命令如下:

 

eric-desktop support-files # cp mysql.server /etc/init.d/mysql
eric-desktop support-files # chmod +x /etc/init.d/mysql
eric-desktop support-files # chkconfig -add mysql
 

出现如下报错:

 

insserv: warning: script 'K20acpi-support' missing LSB tags and overrides
insserv: warning: script 'S51mintsystem' missing LSB tags and overrides
insserv: warning: script 'rsyslog-kmsg' missing LSB tags and overrides
insserv: warning: script 'udevtrigger' missing LSB tags and overrides
insserv: warning: script 'usplash' missing LSB tags and overrides
insserv: warning: script 'acpid' missing LSB tags and overrides
insserv: warning: script 'udev-finish' missing LSB tags and overrides
insserv: warning: script 'anacron' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0) of script `halt' overwrites defaults (empty).
insserv: warning: script 'dbus' missing LSB tags and overrides
insserv: warning: script 'hal' missing LSB tags and overrides
insserv: warning: script 'acpi-support' missing LSB tags and overrides
insserv: warning: script 'module-init-tools' missing LSB tags and overrides
insserv: warning: script 'cryptdisks-enable' missing LSB tags and overrides
insserv: warning: script 'rsyslog' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `sendsigs' overwrites defaults (empty).
insserv: warning: script 'udev' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `wpa-ifupdown' overwrites defaults (empty).
insserv: warning: current start runlevel(s) (0 6) of script `umountnfs.sh' overwrites defaults (empty).
insserv: warning: script 'hwclock-save' missing LSB tags and overrides
insserv: warning: script 'cron' missing LSB tags and overrides
insserv: warning: script 'sreadahead' missing LSB tags and overrides
insserv: warning: script 'hwclock' missing LSB tags and overrides
insserv: warning: script 'network-manager' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (6) of script `reboot' overwrites defaults (empty).
insserv: warning: script 'avahi-daemon' missing LSB tags and overrides
insserv: warning: script 'gdm' missing LSB tags and overrides
insserv: warning: script 'atd' missing LSB tags and overrides
insserv: warning: script 'udevmonitor' missing LSB tags and overrides
insserv: warning: script 'ufw' missing LSB tags and overrides
insserv: warning: script 'procps' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `umountfs' overwrites defaults (empty).
insserv: warning: current start runlevel(s) (0 6) of script `networking' overwrites defaults (empty).
insserv: warning: current start runlevel(s) (0 6) of script `umountroot' overwrites defaults (empty).
insserv: warning: script 'mintsystem' missing LSB tags and overrides
insserv: warning: script 'dmesg' missing LSB tags and overrides
insserv: There is a loop between service rsyslog and pulseaudio if stopped
insserv:  loop involving service pulseaudio at depth 3
insserv:  loop involving service rsyslog at depth 2
insserv:  loop involving service udev at depth 1
insserv: There is a loop between service rsyslog and pulseaudio if stopped
insserv:  loop involving service cups at depth 2
insserv: exiting without changing boot order!
/sbin/insserv failed, exit code 1
mysql                     0:off  1:off  2:off  3:off  4:off  5:off  6:off

 

也就是说,加入启动项失败。

 

在网上查到使用下述命令:

 

sudo update-rc.d mysql defaults

 

出现:

 

Adding system startup for /etc/init.d/mysql ...
   /etc/rc0.d/K20mysql -> ../init.d/mysql
   /etc/rc1.d/K20mysql -> ../init.d/mysql
   /etc/rc6.d/K20mysql -> ../init.d/mysql
   /etc/rc2.d/S20mysql -> ../init.d/mysql
   /etc/rc3.d/S20mysql -> ../init.d/mysql
   /etc/rc4.d/S20mysql -> ../init.d/mysql
   /etc/rc5.d/S20mysql -> ../init.d/mysql
 

再次:

eric-desktop support-files #       chkconfig -list mysql

启动成功,并显示:

mysql                     0:off  1:off  2:on   3:on   4:on   5:on   6:off
 

 

 

你可能感兴趣的:(Linux)