Linux_2day

1. 挂载光驱问题

#mount /mnt/cdrom#将光驱挂载在/mnt/cdrom里

有时候这条命令挂载不成功.解决方法:

(a)不一定通用

[[email protected] ~]# mount /dev/cdrom /mnt/cdrom
mount: mount point /mnt/cdrom does not exist#提示/mnt/cdrom未创建
[[email protected] ~]# cd /mnt#进入mnt文件夹
[[email protected] mnt]# mkdir cdrom#创建cdrom文件夹
[[email protected] mnt]# cd ../
[[email protected] /]# mount /dev/cdrom /mnt/cdrom#挂载命令
mount: block device /dev/cdrom is write-protected, mounting read-only#提示/dev/cdrom写入保护
[[email protected] /]# cd /mnt/cdrom#进入/mnt/cdrom文件夹
[[email protected] cdrom]# ls#显示文件列表
j2re-1_4_1_07-linux-i586.bin  mysql-5.1.40-linux-i686-icc-glibc23.tar.gz#光驱里的文件列表

2.MySQL安装

[[email protected] /]# mount /dev/cdrom /mnt/cdrom
mount: block device /dev/cdrom is write-protected, mounting read-only
[[email protected] /]# cd /mnt/cdrom
[[email protected] cdrom]# ls
j2re-1_4_1_07-linux-i586.bin  mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
[[email protected] cdrom]# cp mysql-5.1.40-linux-i686-icc-glibc23.tar.gz  /usr/local/src
[[email protected] cdrom]# cd /usr/local/src
[[email protected] src]# ls
mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
[[email protected] src]# du -sh mysql-5.1.40-linux-i686-icc-glibc23.tar.gz 
119M    mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
[[email protected] src]# tar zxvf mysql-5.1.40-linux-i686-icc-glibc23.tar.gz 
[[email protected] src]# ls
mysql-5.1.40-linux-i686-icc-glibc23  mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
[[email protected] src]# mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql
[[email protected] src]# useradd -s /sbin/nologin mysql
[[email protected] src]# mkdir -p /data/mysql
[[email protected] src]# chown -R mysql:mysql /data/mysql
[[email protected] src]# cd ../
[[email protected] local]# cd ../
[[email protected] local]# cd mysql
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
[[email protected] mysql]# ls /data/mysql/
mysql  test
[[email protected] mysql]# ll /data/mysql/
总计 16
drwx------ 2 mysql root 4096 08-29 06:28 mysql
drwx------ 2 mysql root 4096 08-29 06:28 test
[[email protected] mysql]# ls
bin      data  EXCEPTIONS-CLIENT  INSTALL-BINARY  man         README   share      support-files
COPYING  docs  include            lib             mysql-test  scripts  sql-bench
[[email protected] mysql]# ls support-files/
binary-configure   config.small.ini  my-innodb-heavy-4G.cnf  my-small.cnf         mysql.server
config.huge.ini    magic             my-large.cnf            mysqld_multi.server  ndb-config-2-node.ini
config.medium.ini  my-huge.cnf       my-medium.cnf           mysql-log-rotate
[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql]# chkconfig --list mysqld
mysqld 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig --add mysqld”)
[[email protected] mysql]# chkconfig --add mysqld
[[email protected] mysql]# chkconfig mysqld on
[[email protected] mysql]# chkconfig --list mysqld
mysqld          0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭
[[email protected] mysql]# vim /etc/init.d/mysqld
basedir=/usr/local/mysql#先前存放mysql文件夹的目录

#见此命令(mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql)

datadir=/data/mysql#先前设置的data目录

#见此命令(chown -R mysql:mysql /data/mysql)

[[email protected] mysql]# cp support-files/my-huge.cnf /etc/my.cnf 
[[email protected] mysql]# service mysqld start
Starting MySQL.                                            [确定]
[[email protected] mysql]# ps aux | grep mysql
root      4207  0.0  0.2  65920  1384 pts/0    S    06:34   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/Keefe.pid
mysql     4313  1.0 12.0 526292 60788 pts/0    Sl   06:34   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql --log-error=/data/mysql/Keefe.err --pid-file=/data/mysql/Keefe.pid --socket=/tmp/mysql.sock --port=3306
root      4328  0.0  0.1  61176   772 pts/0    S+   06:34   0:00 grep mysql
[[email protected] mysql]# netstat -lnp | grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4313/mysqld         
[[email protected] mysql]# ls /data/mysql/
ibdata1  ib_logfile0  ib_logfile1  Keefe.err  Keefe.pid  mysql  mysql-bin.000001  mysql-bin.index  test
时间: 2024-08-27 03:09:18

Linux_2day的相关文章