Log on to the system as root
1. Download the Installation File mysql-5.1.11-beta-solaris10-sparc-64bit.pkg.gz from dev.mysql.com. and save it to/tmp.
2 decompress GZ format Installation File gunzip mysql-5.1.11-beta-solaris10-sparc-64bit.pkg.gz
3. Create a MySQL user group and user, and specify the home directory for the user.
Groupadd MySQL
Useradd-G MySQL
Mkdir/export/home/MySQL
Chgrp MySQL/export/home/MySQL
Chown MySQL/export/home/MySQL
Usermod-D/export/home/MySQL
You can use Su-MYSQL to verify whether MySQL can log on.
4 install PKG
Pkgadd-D mysql-5.1.11-beta-solaris10-sparc-64bit.pkg
MySQL is installed to/opt/MySQL/
5. Tasks after installation
Create directory connection
CD/usr/local
Ln-S/opt/MySQL
Create a configuration file
VI/etc/My. CNF
[Mysqld]
Basedir =/usr/local/MySQL
Datadir =/usr/local/MySQL/Data
6. initialize MySQL
CD/usr/local/MySQL
Scripts/mysql_install_db -- user = MySQL
7. Start the MySQL server
Switch to MySQL user
/Usr/local/MySQL/bin/mysqld-Max &
Or
/Usr/local/MySQL/bin/mysqld-max -- user = MySQL &
Root users cannot directly start the MySQL server
8. Disable the server
Mysqladmin-u root Shutdown
9 uninstall MySQL
Root User execution
Pkgrm MySQL
Installing MySQL from a binary distribution package is easier than installing MySQL from source code
However, the MySQL installation manual does not provide any solutions to errors.
For example
/Opt/MySQL/bin/mysqld-MAX: Table 'mysql. general_log 'doesn' t exist
060716 10:50:16 [Error] fatal error: Can't open and lock privilege tables: Table 'mysql. host' doesn' t exist
The configuration file/etc/My. CNF is not created.
In addition, the PKG package automatically creates permissions for related MySQL directories and does not need to be manually performed as described in the installation manual.
Note the important things that may be used in the MySQL configuration process:
Set User Permissions by directly modifying the authorization table:
Shell> MySQL -- user = root MySQL
Mysql> insert into user (host, user, password) values ('localhost', 'custom', password ('stupid '));
Mysql> insert into user (host, user, password) values ('server. Domain ', 'custom', password ('stupid '));
Mysql> insert into user (host, user, password) values ('whitehouse. gov ', 'custom', password ('stupid '));
Mysql> insert into DB
(Host, DB, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv)
Values ('localhost', 'bankaccount', 'custom', 'y', 'y ');
Mysql> insert into DB
(Host, DB, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv)
Values ('whitehouse. gov ', 'expenses', 'custom', 'y', 'y ');
Mysql> insert into dB (host, DB, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv)
Values ('%', 'customer', 'custom', 'y', 'y ');
Mysql> flush privileges;
By default, MySQL cannot be remotely connected. You need to modify the permission settings:
Two methods:
In the command line, there can be two similar methods for this setting:
(1) mysql> grant all privileges on *. * to root @ localhost identified by 'something' with grant option;
Mysql> grant all privileges on *. * to root @ "%" identified by 'something' with grant option;
In the first sentence, a root user is added to authorize access through a local machine (localhost) with the password "something ".
In the second sentence, the wildcard is used to grant the root user access initiated from any other host.
(2) You can also directly use the update statement to modify the user table: Use the root user or another user to log on to MySQL and go to the MySQL database.
Update user set host = 'localhost' where user = 'root ';
Flush privileges; // only allow root to log on to the Local Machine
Update user set host = '%' where user = 'root ';
Flush privileges; // allow remote access by the root user
In MySQL 4.1 or later versions, the password hash algorithm has changed, which may cause some client connection failures using the old protocol, and the error message is displayed: 1251 client does not support Authentication Protocol requested by server; consider upgrading MYSQL client. Here is the corresponding solution:
Mysql> Update mysql. User SET Password = old_password ('yourpwd') where host = 'yourhost' and user = 'username ';
Mysql> flush privileges;