View MySQL information in Linux environment (reposted)

Address: http://blog.sina.com.cn/s/blog_6c91084e0100lsho.html

Check whether the Linux operating system has installed MYSQL
rpm -qa mysql
mysql-4.1.7-4.RHEL4.1
Click on the detail of mysql in add/remove programe and
hook on mysql-server
2. Start
to detect whether mysql has started
service mysqld status
We can start Mysql in three ways:
Method 1: Use the service command to
start Mysql
service mysqld start
Stop mysql
service mysqld stop
Method 2: Use the mysqld script to start Mysql:
/etc/init.d/mysql start
Method 3: Use The safe_mysqld utility program starts the Mysql service. This method can use the relevant parameters
safe_mysqld& //Use & to indicate that safe_mysqld is executed in the background.
3. Login and
change the password
mysqladmin -u root password
mysqladmin -u root password 'kaishi'
The "password" here is the password we want to set up. The system will prompt us to enter the old password (if mysql has just been installed, the default password is empty)
The machine can log in. However, the client login of other machines reports an error.
ERROR 1130 (00000): Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL
server
First check the settings of iptables, add open port 3306
iptables -A INPUT -p tcp -m tcp --sport 3306 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 3306 -j ACCEPT
service iptables save
service iptables restart
Or other machines can not access, it is estimated that MYSQL Based permissions.
Log in to mysql on the local machine
-h localhost -u root -pkaishi
show databases;
use mysql;
select Host, User, Password from user;
+--------------------- --+------+------------------------------------------------------ ---+
| Host | User | Password |
+-------------+------+------- ------------------------------------+
| localhost | root | *18F54215F48E644FC4E0F05EC2D39F88D7244B1A |
| localhost.localdomain | root | |
| localhost.localdomain | | |
| localhost | | |
+-------------+------+--- -----------------------------------------+
You can see the above results, only localhost set access permissions
Enter mysql, create a new user user:
format: grant permission on database name. table name user@login host identified by "user password";
grant select,update,insert,delete on easyview.* to  [email protected]  identified by "kaishi";
to view the results, execute:
use mysql;
select host,user,password from user;
You can see that the user user just created already exists in the user table. The host field indicates the login host, and its value can be IP or host name. Changing the value of the host field to % means that the user user can log in to the mysql server on any client machine. It is recommended to set it to % during development. .
update user set host = '%' where user = 'sillycat';
flush privileges;
after modifying the permissions, you need to execute the above statement to take effect

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326814942&siteId=291194637