Files frequently modified in linux 2

Source: Internet
Author: User
Tags mysql host mysql manual import database ssh server
Linux often modified file 22001 permanent change ip edit/etc/sysconfig/network-scripts/ifcfg-eth0 file, modify ip, and then execute ifdowneth0; ifupeth02002 allow | prohibit root through SSH login to modify sshd_config: permitRootLoginno | ye... linux files that are frequently modified 2 2001 permanent change ip edit/etc/sysconfig/network-scripts/ifcfg-eth0 files, modify ip, and then execute ifdown eth0; ifup eth02002 allow | prohibit root from logging on to sshd_config: PermitRootLogin no via SSH | yes 2003 change the sshd Port by adding a line: Port 2222,/etc/init to/etc/ssh/sshd_config. d/sshd restart daemon 2004 anti-DDoS Stop anyone from using the su command to become root1.vi/etc/pam. d/suauth sufficient/lib/security/pam_rootok.so debugauth required/lib/security/pam_wheel.so group = wheel2. in/etc/pam. the d/su configuration file defines how to enable ssh to allow only the specified user to log on to the wheel Group 2005 in the/etc/pam. add auth required pam_listfile.so item = user sense = allow file =/etc/sshusers onerr = fail to the d/sshd file, create the sshusers file under/etc, and edit the file, add the user name you allow to use the ssh service and restart the sshd service. Method 2: pam rules can also be written as deny auth required pam_listfile.so item = user sense = deny file =/etc/sshusers onerr = succeed method 3: Set AllowUsers in sshd_config, for example, if the format is AllowUsers a B c, restart the sshd service, only a/B/c3 users can log on to the 2006 compressed transmission file or directory for remote transmission: tar czf-www | ssh server "tar zxf-" compressed to remote: tar czf-www | ssh server "cat> www.tar.gz" decompressed to remote: ssh server "tar zxf-" <www.tar.gz unzip to local: ssh server "cat www.tar.gz" | tar zxf-2007 rsync synchronizes compressed transfer files or directories rsync-az E ssh -- delete sample_dir/remote_host: remote_dir/sample_dir/at the end of the directory/cannot be less than 2008. you do not need to enter a password to log on to ssh-keygen-B 1024-t rsassh server "mkdir. ssh; chmod 0700. ssh "scp ~ /. Ssh/id_rsa.pub server :~ /. Ssh/authorized_keys, you can directly log on to the server and add these two statements to the ssh_config file replication and synchronization operations. This makes it easier for ForwardAgent yesStrictHostKeyChecking no3001 where mysql data inventory is stored. 1. if the rpm Package is used for installation, the directory name of the database should be 2 in the/var/lib/mysql directory. if the source code is installed in/usr/local/mysql, it should be in/usr/local/mysql/var, export and import data from mysql using the database name directory name 3002 export database mysqldump database name> file name import database mysqladmin create database name mysql database name <file name 3003 forgot mysql root password what to do # service mysql stop # mysqld_safe -- skip-gr Ant-tables & # mysqladmin-u user password 'newpassword' # mysqladmin flush-privileges3004 there are two ways to modify the root password of mysql: 1. mysql> mysql-uroot-pxxx mysqlmysql> update user set password = password ('New _ password') where user = 'user'; mysql> flush privileges; 2. format: mysqladmin-u username-p old password new password # mysqladmin-uroot-password ab12 note: Because the root has no password at the beginning, so the old-p password can omit 3005 how to use rpm to install mysql first download the appropriate rpm package, such as downloading the file MySQL-5.0.19-0. I386.rpm install with the following method: # rpm-ivhU MySQL-5.0.19-0.i386.rpm usually, after installing this rpm package, only has the function of mysqld service, other related client programs and development kit also need to install # rpm-ivhU MySQL-devel-5.0.19-0.i386.rpm # rpm-ivhU MySQL-client-5.0.19-0.i386.rpm3006 how to install the compiled mysql binary package first download the appropriate binary package, for example, the downloaded file mysql-standard-4.1.13-pc-linux-gnu-i686.tar.gz # groupadd mysql # useradd-g mysql # cd/usr/local # tar zxf mysql-standard-4.1.13-pc-linux-gnu-i686.tar.gz # ln-s mysql-st Andard-4.1.13-pc-linux-gnu-i686 mysql # cd mysql # scripts/mysql_install_db -- user = mysql # chgrp-R mysql * # bin/mysqld_safe -- user = mysql & what are the personalized configurations, you can create/etc/my. cnf or/usr/local/mysql/data/my. cnf, add related parameters to achieve 5007 how to compile mysql to redhat linux 9.0 as an example: download the file mysql-4.1.13.tar.gz # tar zxf mysql-4.1.13.tar.gz # cd mysql-4.1.13 #. /configure -- prefix =/usr/local/mysql -- enable-validator \ -- with-mysqld-ldflags =-all-static -- Localstatedir =/usr/local/mysql/data \ -- with-unix-socket-path =/tmp/mysql. sock -- enable-memory er \ -- with-charset = complex -- with-low-memory -- with-mit-threads # make install # groupadd mysql # useradd-g mysql # chgrp -R mysql/usr/local/mysql/#/usr/local/mysql/bin/mysqld_safe -- user = mysql & what are the personalized configurations, you can create/etc/my. cnf or/usr/local/mysql/data/my. cnf, add related parameters to achieve 5009 how to log on to mysql using the client tool provided by mysql # PA TH_TO_MYSQL/bin/mysql-uuser-ppassword dateabase5010 mysqld is up, but cannot log on, prompting "/var/lib/mysql. sock "does not exist (yejr). In most cases, because your mysql is installed in rpm mode, it will automatically find/var/lib/mysql. log on to mysql through unix socket. Common solutions: 1. create/modify a file/etc/my. cnf: Add/modify at least one line [mysql] [client] socket =/tmp/mysql. sock # write your mysql here. the correct position of sock, usually under/tmp/or under/var/lib/mysql/. 2. specify the IP address and connect to mysql through tcp, instead of using the local sock method # mysql-h127.0.0.1-uuser-ppassword3, for mysql. sock adds a connection, such as the actual mysql. if sock is under/tmp/, # ln-s/tmp/mysql. sock/var/lib/mysql. sock: 5011 add a mysql User format: grant select on database. * to username @ login host identified by "password" example 1. add a user test1 whose password is abc, Allows him to log on to any host and have the query, insert, modify, and delete permissions on all databases. First, use the root user to connect to MYSQL, and then type the following command: mysql> grant select, insert, update, delete on *. * to test1 @ "%" Identified by "abc"; however, the added user in Example 1 is very dangerous. if someone knows the password of test1, then he can log on to your mysql database on any computer on the internet and do whatever he wants for your data. for the solution, see example 2. Example 2: Add a user named "test2" with the password "abc" so that the user can only log on to localhost, you can also query, insert, modify, and delete the database mydb (localhost refers to the local host, that is, the host where the MYSQL database is located), so that the user knows the password of test2, he cannot access the database directly from the internet, but can only access the database through the web pages on the MYSQL host. Mysql> grant select, insert, update, delete on mydb. * to test2 @ localhost identified by "abc"; if you do not want test2 to have a password, you can run another command to cancel the password. Mysql> grant select, insert, update, delete on mydb. * to test2 @ localhost identified by ""; in addition, you can insert a new record directly to the user table to achieve 5012. how can you view the mysql database mysql> show databases; 5013 how to view the tables in the database mysql> show tables; 5014 common data export methods 1. use mysqldump # mysqldump-uuser-ppassword-B database -- tables table1 -- tables table2> dump_data_20051206. SQL detailed parameters 2. backup to syntax mysql> BACKUP TABLE tbl_name [, tbl_name...] TO '/path/to/backup/directory'; for details, see mysql manual 3. mysqlhotcopy # mysqlhotcopy db_name [/path/to/new_directory] or # mysqlhotcopy db_name_1... db_name_n/path/to/new_directory or # mysqlhotcopy db_name. /regex/for details, see mysql Manual 4. for details about select into outfile, see mysql Manual 5. client command line # mysql-uuser-ppassword-e "SQL statements" database> result.txt and above method, how to execute SQL statements (yejr) on the command line using mysqldump) # mysql-uuser-ppassword-e "SQL statements" database5016 common methods for importing backup files 1. files dumped by mysqld# mysql-uuser-ppassword [database] <dump. sql2. the file type is the same as above. use the source syntax mysql> source/path_to_file/dump. SQL; 3. text files or csv files stored in certain formats # mysqlimport [options] database file1 [file2....] for details, see mysql Manual 4. the file type is the same as above. you can also use the load data syntax to import details. please refer to mysql manual 5017 to enable mysql in large memory mode (Chen Xu) set a mysql under/usr/share/mysql -*. cnf (such as 1G memory for mysql-huge.cnf) copy to/etc/mysql. cnf file, and restart mysql
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.