linux問題總結
1.修改redhat enterprise5 語言
問題描述:切換語言
|
cd /etc/sysconfig
vi i18n
將LANG=en_US.UTF-8
改成LANG=zh_CN.gb2312 |
2.bash: ifconfig: command not found
問題描述:
切換到root使用者下
[root@localhost /]$ ifconfig
依然提示:“bash: ifconfig: command not found”
|
whereis ifconfig 看一下這個命令在哪個目錄下
方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出現使用了
方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin 這樣設定後,下次就可以直接存取了,免處第一種的麻煩
方法三:修改/etc/profile檔案,注釋掉if語句即可
把下面的if語句注釋掉:
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
修改為
# Path manipulation
# if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
#fi |
3. redhat linux開機就進入到命令列
|
vi /etc/inittab id:5:initdefault: 把這一句裡面的5改成3就 |
4. redhat安裝JDK失敗
在 red hat enterprise linux5安裝 jdk-7u21-linux-i586.tar.gz 時候出現下面的錯誤 :
|
Error: dl failure on line 864
Error: failed /home/jiangyang/jdk1.7.0_21/jre/lib/i386/client/libjvm.so, because /home/jiangyang/jdk1.7.0_21/jre/lib/i386/client/libjvm.so: cannot restore segment prot after reloc: Permission denied |
解決方案:
|
chcon -t textrel_shlib_t $JAVA_HOME/jre/lib/i386/client/libjvm.so |
5. 設定mysql遠端連線root許可權
|
mysql> Grant all privileges on *.* to 'root'@'%' identified by '密碼' with grant option;
(%表示是所有的外部機器,如果指定某一台機,就將%改為相應的機器名;‘root’則是指要使用的使用者名稱,)
mysql> flush privileges;
(運行此句才生效,或者重啟MySQL) |
6. ubuntu 配置靜態IP
|
root@ubuntu1:~# vi /etc/network/interfaces |
|
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.2.111
netmask 255.255.255.0
gateway 192.168.2.1 |
|
root@ubuntu1:~# /etc/init.d/networking restart |
如果配置動態IP如下:
|
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp |
7Ubuntu 安裝 chkconfig
在Ubuntu中是沒有chkconfig命令,通過安裝chkconfig_11.0-79.1-2_all.deb來達到使用chkconfig命令的目的。
8.ubuntu mysql安裝
安裝mysql-6.0.7-alpha-linux-i686-glibc23.tar.gz版本的linux。
|
groupadd mysql
useradd -g mysql mysql
cd /usr/local
gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
ln -s full-path-to-mysql-VERSION-OS mysql
cd mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
bin/mysqld_safe --user=mysql &
/usr/local/mysql/bin/mysqladmin -u root password ‘新密碼’
cp support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
chkconfig --add mysql
cp support-files/my-medium.cnf /etc/my.cnf
service mysql start |
9. linux下的mysql亂碼
在linux下中使用mysql的話可能會出現中午亂碼的情況。通過查詢mysql的編碼集可以發現是使用的latin1需要修改。
修改/etc/my.cnf設定檔。
|
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=utf8
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
default-character-set=utf8 |
重啟資料庫後再次查看資料庫的編碼集資訊。
|
/etc/init.d/mysql stop
/etc/init.d/mysql start |