Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Create new user :
/usr/bin/mysql -u root -p'root_password' -e "CREATE USER 'user_name'@'127.0.0.1' IDENTIFIED by 'user_password';"
Grant privileges :
/usr/bin/mysql -u root -p'root_password' -e "grant all privileges on 'db_name'.* to 'user_name'@'127.0.0.1' identified by 'user_password'"
I guess, now you can create a new user and assign privileges on a perticular database.
guest@HP-UX645PA ~]$ service mysql start
mysql: unrecognized service
Then:
Code:
[guest@HP-UX645PA ~]$ /usr/bin/mysqladmin -u root password
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
Then:
Code:
[guest@HP-UX645PA ~]$ service mysqld start
touch: cannot touch `/var/log/mysqld.log': Permission denied
chown: changing ownership of `/var/log/mysqld.log': Operation not permitted
chmod: changing permissions of `/var/log/mysqld.log': Operation not permitted
chown: changing ownership of `/var/lib/mysql': Operation not permitted
chmod: changing permissions of `/var/lib/mysql': Operation not permitted
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
mysqld isn't installed I guess. If you're on a redhat clone, try "yum install mysql-server" however as above I'm concerned that you have no root access to this system as you're on a "guest" account.
What do you actually want to do with MySQL in the first place? You expect to use a database running on the local machine, or connect somewhere else? You seem to be just copying and pasting random commands given here to you, so some clarity on your actual goals would help everyone I think.
Last edited by acid_kewpie; 07-25-2012 at 02:32 AM.
The program "mysql" is the client you use to connect to a mysql server. The program "mysqld" is the server program. It runs as a service, and you should have the service start when you boot.
You should download the mysql reference manual for your mysql version (run "/usr/sbin/mysqld --version" to find out your version) It has instructions on creating users, and importantly, what you need to do after installing mysql to secure it. http://dev.mysql.com/doc/
You need to create a password for the root mysql user. Dropping the default demo database is also advisable. See section 2.10.2: "Securing the Initial MySQL Accounts"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.